0023523: In session DRAW it is impossible to close document having name already once...
[occt.git] / tests / bugs / caf / bug23489
1 # Test for #23489: memory leak in TNaming_NamedShape destructor
2
3 pload OCAF
4
5 # take some big file to be loaded
6 set file [locate_data_file Bottom.brep]
7
8 set listmem {}
9 for {set i 1} {$i < 10} {incr i} {
10     # load big shape
11     restore $file a
12
13     # add shape to new OCAF document
14     NewDocument D MDTV-Standard
15
16     # add shape to document
17     SetShape D 0:1 a
18
19     # Note: if ForgetAll or Undo is called here, memory is correctly freed!
20     # ForgetAll D 0:1
21
22     # close document
23     Close D
24    
25
26     # unload shape (replace by small one)
27     vertex a 0 0 0
28
29     # check memory usage (with tolerance equal to half page size)
30     lappend listmem [expr [meminfo w] / 1024]
31     if { [checktrend $listmem 0 256 "Memory leak detected"] } {
32         puts "No memory leak, $i iterations"
33         break
34     }
35 }