5 #######################################################################
6 puts "Visualization - improve selection mechanism"
7 # tests memory leaks in creation of selection primitives for connected
8 # interactive objects: checks that there is no "dead links" in removing
9 # Select3D_BVHPrimitiveContent
10 #######################################################################
13 pload MODELING VISUALIZATION
19 set aMemInit [meminfo h]
24 eval compound [lrepeat $aNb s] ss
26 for {set i 1} {$i <= $aNb} {incr i} { vloadselection ss_${i}; vsetlocation -noupdate ss_${i} 0 0 s }
28 set aMemSel1 [meminfo h]
30 set aMemClear1 [meminfo h]
32 # display as connected instances of single presentation
33 vconnectto i_1 0 0 0 s -nodisplay
35 for {set i 2} {$i < $aNb} {incr i} { vconnectto i_${i} ${i} 0 0 i_1 -nodisplay; vloadselection i_${i} }
36 set aMemSel2 [meminfo h]
38 set aMemClear2 [meminfo h]
40 puts "Initial memory : [expr $aMemInit / (1024 * 1024)] MiB"
41 puts "Compute selection (simple) : [expr $aMemSel1 / (1024 * 1024)] MiB"
42 puts "Clearing (simple) : [expr $aMemClear1 / (1024 * 1024)] MiB"
43 puts "Compute selection (connected): [expr $aMemSel2 / (1024 * 1024)] MiB"
44 puts "Clearing (connected) : [expr $aMemClear2 / (1024 * 1024)] MiB"
46 set aRatio [expr $aMemClear2 / double($aMemClear1)]
48 # check if the memory difference is greater than 10%
49 if {[expr $aRatio > 1.1]} {
50 puts "Error : TEST FAILED"