--- /dev/null
+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