0023161: Select publicly accessible data files for OCCT tests
[occt.git] / tests / bugs / caf / bug23489
CommitLineData
deb26df7
RL
1# Test for #23489: memory leak in TNaming_NamedShape destructor
2
3pload OCAF
4
351bbcba 5# take some big file to be loaded
6set file [locate_data_file Bottom.brep]
7
deb26df7
RL
8set listmem {}
9for {set i 1} {$i < 10} {incr i} {
10 # load big shape
351bbcba 11 restore $file a
deb26df7
RL
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 unset D
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}