1 # This TCL script demonstrates memory leak in OCAF Undo/Redo
3 # The DRAW command TestOCAF (provided separately) just reads
4 # the specified brep file
5 # and puts it into the document on a given label.
6 # This operation is done and undone several times,
7 # and the problem is that each time additional memory
8 # (approximately equivalent to the size of shape)
11 # While obviously it should not be so: even if Undo keeps the
12 # shape in memory as delta on Redo, this delta should be cleared
13 # by the next operation!
15 # The bug persists with any setting of variables MMGT_OPT and MMGT_MMAP
16 # (while with different initial size and step) and
18 # It seems that either delta is not completely freed, or some
19 # other data structures keep the shape memory
29 set BREP [locate_data_file BUC60921.brep]
30 #set BREP [locate_data_file Bottom.brep]
32 NewDocument D MDTV-Standard
37 for {set i 1} {$i <= ${i_max}} {incr i} {
40 BUC60921 D 0:1:1 $BREP
46 # check memory usage (with tolerance equal to half page size)
47 lappend listmem [expr [meminfo w] / 1024]
48 if { [checktrend $listmem 0 512 "Memory leak detected"] } {
49 puts "No memory leak, $i iterations"