From 465d1a2c7e108631d8ebd65280801722602b6c3d Mon Sep 17 00:00:00 2001 From: abv Date: Thu, 24 Oct 2013 13:14:33 +0400 Subject: [PATCH] 0024264: OCCT 6.6.0: cutting 1600 cylinders from a box leads to out-of-memory on 32-bit system Added test case (perf bop boxholes) --- tests/perf/bop/boxholes | 71 ++++++++++++++++++++++++++++++++++++ tests/perf/bspline/intersect | 5 +-- tests/perf/end | 4 +- tests/perf/grids.list | 1 + 4 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 tests/perf/bop/boxholes diff --git a/tests/perf/bop/boxholes b/tests/perf/bop/boxholes new file mode 100644 index 0000000000..ae4cba0ddc --- /dev/null +++ b/tests/perf/bop/boxholes @@ -0,0 +1,71 @@ +puts "========" +puts "CR24264" +puts "========" +puts "" +####################################################################### +# OCCT 6.6.0: cutting 1600 cylinders from a box leads to out-of-memory on 32-bit system +####################################################################### + +# test cutting box by many holes, inspired by +# http://www.opencascade.org/org/forum/thread_12369/?forum=3 +# in OCCT 6.6.0 32-bit mode on Windows this fails with N >= 40 (out of memory) + +# box plate to cut the holes from +box b 100 100 1 + +# N defines number of holes along each of X and Y, thus total N^2 holes +# will be drilled; note that the algorithm iself is likely to be quadratic +# for number of shapes, i.e. CPU ~ N^4 +set N 40 +set holes {} +for {set i 1} {$i < $N} {incr i} { + for {set j 1} {$j < $N} {incr j} { + pcylinder p_${i}_$j 0.5 1 + ttranslate p_${i}_$j [expr $i * 100. / $N] [expr $j * 100. / $N] 0. + lappend holes p_${i}_$j + } +} + +eval compound $holes drill + +set mem1 [meminfo h] + +dchrono cpu reset +dchrono cpu start + +bcut r b drill + +dchrono cpu stop +puts [dchrono cpu show] +set q2 [dchrono cpu show] + +set mem2 [meminfo h] + +set mem1 [expr ${mem1}/(1024 * 1024)] +set mem2 [expr ${mem2}/(1024 * 1024)] +set mem_delta 70 +puts "mem1=${mem1}" +puts "mem2=${mem2}" +puts "mem_delta=${mem_delta}" + +if { [expr ${mem2} - ${mem1}] > ${mem_delta}} { + puts "Faulty : there is memory leak" +} + +regexp {CPU user time: ([-0-9.+eE]+) seconds} ${q2} full z +if { [string compare $tcl_platform(platform) "windows"] == 0 } { + puts "OS = Windows NT" + set max_time 200 +} else { + puts "OS = Linux" + set max_time 250 +} +if { ${z} > ${max_time} } { + puts "Elapsed time is more than ${max_time} seconds - Faulty" +} else { + puts "Elapsed time is less than ${max_time} seconds - OK" +} + +vinit +vdisplay r +vfit diff --git a/tests/perf/bspline/intersect b/tests/perf/bspline/intersect index b95a78fee7..ae9625a2cc 100644 --- a/tests/perf/bspline/intersect +++ b/tests/perf/bspline/intersect @@ -204,7 +204,4 @@ foreach s1 $surfaces { } } -# call vinit just to prepare for snapshot -#eval vdisplay $shapes -vinit -fit +#eval vdisplay $shapes; vfit diff --git a/tests/perf/end b/tests/perf/end index fbbef48395..d2eb8230b0 100755 --- a/tests/perf/end +++ b/tests/perf/end @@ -1,3 +1,5 @@ -vdump $imagedir/${test_image}.png +if { "[vviewlist]" != "" } { + vdump $imagedir/${test_image}.png +} puts "TEST COMPLETED" diff --git a/tests/perf/grids.list b/tests/perf/grids.list index 1a558e7d17..e2ad5b9f47 100644 --- a/tests/perf/grids.list +++ b/tests/perf/grids.list @@ -15,3 +15,4 @@ 015 single_object_shading 016 single_object_wireframe 017 bspline +018 bop