array C_nextFree595 integer C_firstFree840 integer C_maxIndex188 array C_typeId116 integer C_firstFree840 = 0 integer C_maxIndex188 = 0 function initGlobals209() { } function main644() { initGlobals209(); init_test209(); } function config181() { } function init_test209() { local array cs203 local integer i583 i_583 = 0; loop { exitwhen (i_583 > 6000); cs_203[i_583] = new_C209(); i_583 = (i_583 + 1); }; i_583 = 0; loop { exitwhen (i_583 > 6000); dispatch_C_destroyC250(cs_203[i_583]); i_583 = (i_583 + 1); }; i_583 = 0; loop { exitwhen (i_583 > 6000); cs_203[i_583] = new_C209(); i_583 = (i_583 + 1); }; if ((cs_203[6000] castTo integer) <= 6001) { testSuccess194(); } else { }; } IS_NATIVE function testSuccess194() { } function C_init148(integer this211) { } function new_C209() returns integer { local integer this256 this_256 = alloc_C172(); construct_C568(this_256); return this_256; } function construct_C568(integer this106) { C_init148(this_106); } function C_onDestroy536(integer this140) { } function destroyC763(integer this150) { C_onDestroy536(this_150); dealloc_C535(this_150); } function alloc_C172() returns integer { local integer this130 if (C_firstFree_840 == 0) { if (C_maxIndex_188 < 32768) { C_maxIndex_188 = (C_maxIndex_188 + 1); this_130 = C_maxIndex_188; C_typeId_116[this_130] = 1; } else { error180("Out of memory: Could not create C."); this_130 = 0; }; } else { C_firstFree_840 = (C_firstFree_840 - 1); this_130 = C_nextFree_595[C_firstFree_840]; C_typeId_116[this_130] = 1; }; return this_130; } function error180(string msg118) { $debugPrint733((msg_118 + (" " + #getStackTrace()))); } function dealloc_C535(integer obj184) { if (C_typeId_116[obj_184] == 0) { error180("Double free: object of type C"); } else { C_nextFree_595[C_firstFree_840] = obj_184; C_firstFree_840 = (C_firstFree_840 + 1); C_typeId_116[obj_184] = 0; }; } function dispatch_C_destroyC250(integer this151) { if (C_typeId_116[this_151] == 0) { if (this_151 == 0) { error180("Nullpointer exception when calling C.C"); } else { error180("Called C.C on invalid object."); }; } else { }; destroyC763(this_151); }