0024623: Visualization - improve selection mechanism
[occt.git] / tests / bugs / vis / bug24623_4
1 puts "============"
2 puts "OCC24623_4"
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" to reference
9 #                      interactives after its clearing
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 vinit
19 vclear
20
21 set aMemInit [meminfo h]
22 set anIterNb 100
23
24 for {set anIterCount 0} {$anIterCount < $anIterNb} {incr anIterCount} {
25     set aNb 11
26
27     vconnectto i_1 0 0 0 s -nodisplay
28     vloadselection i_1
29     for {set i 2} {$i < $aNb} {incr i} { vconnectto i_${i} ${i} 0 0 i_1 -nodisplay; vloadselection i_${i} }
30     vclear
31 }
32
33 set aMemClear [meminfo h]
34
35 puts "Initial memory : [expr $aMemInit   / (1024 * 1024)] MiB"
36 puts "Clearing       : [expr $aMemClear  / (1024 * 1024)] MiB"
37
38 set aRatio [expr $aMemClear / double($aMemInit)]
39
40 # check if the memory difference is greater than 20%
41 if {[expr $aRatio > 1.2]} {
42     puts "Error : TEST FAILED"
43 }