While running some benchmarks on HxCPP I have managed to crash the application by doing the following :
class Test {
static var t0 = getTime();
static function getTime() {
return haxe.Timer.stamp();
}
static function time(where,?pos) {
var dt = getTime() - t0;
haxe.Log.trace(where+" "+dt,pos);
t0 = getTime();
}
static function main() {
var count = 1000000;
time("Startup");
var a = [];
for( i in 0...count ) {
var m = new h3d.Matrix();
m.identity();
m._41 = i;
a.push(m);
}
time("Allocation");
a = [];
for( i in 0...count ) {
var m = new h3d.Matrix();
m.identity();
m._41 = i;
a.push(m);
}
time("Allocation2");
}
}