13 from rtc_handle
import *
14 from BasicDataType_idl
import *
18 env =
RtmEnv(sys.argv, [
"localhost:9898"])
19 list0 = env.name_space[
"localhost:9898"].list_obj()
20 env.name_space[
'localhost:9898'].rtc_handles.keys()
22 ns = env.name_space[
'localhost:9898']
26 compo1 = ns.rtc_handles[
"ConsoleIn0.rtc"]
27 compo0 = ns.rtc_handles[
"ConsoleOut0.rtc"]
28 seqin0 = ns.rtc_handles[
"SequenceInComponent0.rtc"]
30 ec = compo0.rtc_ref.get_owned_contexts()
33 (stat, output) = commands.getstatusoutput(
"ps alxww | grep \"[r]\"tcd")
34 return output.split()[7]
40 fout.write(out_data +
'\n')
48 fout.write(out_data +
'\n')
54 if rss_start != rss_end:
55 fodat =
" result: memory leak was found !!!" 57 fodat =
" result: memory leak was not found." 62 test_case =
"AttachDetachRTCTest" 63 fout = open(test_case +
".log",
'w')
65 fodat =
"=== " + test_case +
" start ===" 70 fodat =
"attach_context() and detach_context()" 73 for i
in range(loop_cnt):
75 ec_id = compo0.rtc_ref.attach_context(ec[0])
79 retcode = compo0.rtc_ref.detach_context(ec_id)
83 rss0 =
mem_rss() ; j0 = 0 ; rssStart = rss0
84 fodat =
" %05d: %s KB start" % (1, rss0)
88 fodat =
" %05d: %s KB -> %d KB. count diff -> %d" % (i+1, rss1,int(rss1)-int(rss0),int(j1)-int(j0) )
93 fodat =
" %05d: %s KB end" % (i+1, rssEnd)
98 fodat =
"=== " + test_case +
" end ==="
def print_file_and_cons(out_data, out_flag=0)
file and console out
def leak_check(rss_start, rss_end)
memory leak check