0027958: Visualization, AIS_Trihedron - add shaded presentation option
[occt.git] / tests / bugs / vis / bug24623_3
CommitLineData
f751596e 1puts "============"
2puts "OCC24623_3"
3puts "============"
4puts ""
5#######################################################################
6puts "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
12puts ""
13pload MODELING VISUALIZATION
14psphere s 0.5
15tclean s
16incmesh s 0.001
17trinfo s
18
19set aMemInit [meminfo h]
20
21set aNb 1000
22
23# display as copies
24eval compound [lrepeat $aNb s] ss
25explode ss
1beb58d7 26for {set i 1} {$i <= $aNb} {incr i} { vloadselection ss_${i}; vsetlocation -noupdate ss_${i} ${i} 0 0 }
f751596e 27vfit
28set aMemSel1 [meminfo h]
29vclear
30set aMemClear1 [meminfo h]
31
32# display as connected instances of single presentation
33vconnectto i_1 0 0 0 s -nodisplay
34vloadselection i_1
35for {set i 2} {$i < $aNb} {incr i} { vconnectto i_${i} ${i} 0 0 i_1 -nodisplay; vloadselection i_${i} }
36set aMemSel2 [meminfo h]
37vclear
38set aMemClear2 [meminfo h]
39
40puts "Initial memory : [expr $aMemInit / (1024 * 1024)] MiB"
41puts "Compute selection (simple) : [expr $aMemSel1 / (1024 * 1024)] MiB"
42puts "Clearing (simple) : [expr $aMemClear1 / (1024 * 1024)] MiB"
43puts "Compute selection (connected): [expr $aMemSel2 / (1024 * 1024)] MiB"
44puts "Clearing (connected) : [expr $aMemClear2 / (1024 * 1024)] MiB"
45
46set aRatio [expr $aMemClear2 / double($aMemClear1)]
47
48# check if the memory difference is greater than 10%
49if {[expr $aRatio > 1.1]} {
50 puts "Error : TEST FAILED"
51}