0027986: Visualization - AIS_InteractiveContext::SetLocation() does not update dynami...
[occt.git] / tests / bugs / vis / bug24623_3
1 puts "============"
2 puts "OCC24623_3"
3 puts "============"
4 puts ""
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 #######################################################################
11
12 puts ""
13 pload MODELING VISUALIZATION
14 psphere s 0.5
15 tclean  s
16 incmesh s 0.001
17 trinfo  s
18
19 set aMemInit [meminfo h]
20
21 set aNb 1000
22
23 # display as copies
24 eval compound [lrepeat $aNb s] ss
25 explode ss
26 for {set i 1} {$i <= $aNb} {incr i} { vloadselection ss_${i}; vsetlocation -noupdate ss_${i} 0 0 s }
27 vfit
28 set aMemSel1  [meminfo h]
29 vclear
30 set aMemClear1 [meminfo h]
31
32 # display as connected instances of single presentation
33 vconnectto i_1 0 0 0 s -nodisplay
34 vloadselection i_1
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]
37 vclear
38 set aMemClear2 [meminfo h]
39
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"
45
46 set aRatio [expr $aMemClear2 / double($aMemClear1)]
47
48 # check if the memory difference is greater than 10%
49 if {[expr $aRatio > 1.1]} {
50     puts "Error : TEST FAILED"
51 }