11 set BREP [locate_data_file BUC60921.brep]
13 NewDocument D MDTV-Standard
19 for {set i 1} {$i <= ${i_max}} {incr i} {
22 BUC60921 D 0:1:1 $BREP
24 catch {exec ps -e -o vsz,comm | grep $EXEID } res
25 puts "Iteration $i: virtual memory consumption = $res"
26 set Mem1 [lindex ${res} 0]
27 if { ${IsFirstTime} == 1} {
34 catch {exec ps -e -o vsz,comm | grep $EXEID } res
35 puts "Iteration $i: virtual memory consumption = $res"
36 set Mem2 [lindex ${res} 0]
37 set Delta [expr abs(${Mem2} - ${Mem1})]
38 set MemoryLeakage [expr ${MemoryLeakage} + ${Delta}]
39 puts " ${i} delta memory consumed: ${Delta} KB"
43 set percent [expr ${MemoryLeakage} / (double(${i_max}) * ${Mem0} ) * 100.]
44 puts "percent = ${percent}"
46 if {${percent} > ${percent_max}} {
47 puts "BUC60921: Error . There is memory leakage during Undo/Redo"
53 # This TCL script demonstrates memory leak in OCAF Undo/Redo
55 # The DRAW command TestOCAF (provided separately) just reads
56 # the specified brep file
57 # and puts it into the document on a given label.
58 # This operation is done and undone several times,
59 # and the problem is that each time additional memory
60 # (approximately equivalent to the size of shape)
63 # While obviously it should not be so: even if Undo keeps the
64 # shape in memory as delta on Redo, this delta should be cleared
65 # by the next operation!
67 # The bug persists with any setting of variables MMGT_OPT and MMGT_MMAP
68 # (while with different initial size and step) and
70 # It seems that either delta is not completely freed, or some
71 # other data structures keep the shape memory
73 #================================================
74 # The two settings below are necessary to localize the script in order
75 # to identify DRAW process among others, and to define path to BREP file
76 # The BREP file should be big anough (>= 1Mb recommended)
78 set BREP /users/det/files/GEAR.brep
79 #================================================