array A_nextFree101 integer A_firstFree953 integer A_maxIndex191 array A_typeId183 integer A_firstFree953 = 0 integer A_maxIndex191 = 0 function initGlobals146() { A_firstFree_953 = 0; A_maxIndex_191 = 0; } function main856() { initGlobals146(); init_Test686(); } function config679() { } function init_Test686() { local integer a882 local integer e200 local integer count1127 local integer count2469 a_882 = new_A177(); new_A177(); new_A177(); new_A177(); e_200 = new_A177(); count1_127 = maxInstanceCount160(1); dispatch_A_destroyA114(a_882); dispatch_A_destroyA114(e_200); count2_469 = maxInstanceCount160(1); if ((count1_127 == 5) and (count2_469 == 5)) { testSuccess452(); } else { }; } IS_NATIVE function testSuccess452() { } function A_init106(integer this383) { } function new_A177() returns integer { local integer this734 this_734 = alloc_A173(); construct_A186(this_734); return this_734; } function construct_A186(integer this188) { A_init106(this_188); } function A_onDestroy942(integer this185) { } function destroyA172(integer this187) { A_onDestroy942(this_187); dealloc_A212(this_187); } function maxInstanceCount160(integer typeId551) returns integer { return A_maxIndex_191; return 0; } function alloc_A173() returns integer { local integer this204 if (A_firstFree_953 == 0) { if (A_maxIndex_191 < 32768) { A_maxIndex_191 = (A_maxIndex_191 + 1); this_204 = A_maxIndex_191; A_typeId_183[this_204] = 1; } else { error106("Out of memory: Could not create A."); this_204 = 0; }; } else { A_firstFree_953 = (A_firstFree_953 - 1); this_204 = A_nextFree_101[A_firstFree_953]; A_typeId_183[this_204] = 1; }; return this_204; } function error106(string msg697) { $debugPrint635((msg_697 + (" " + #getStackTrace()))); } function dealloc_A212(integer obj204) { if (A_typeId_183[obj_204] == 0) { error106("Double free: object of type A"); } else { A_nextFree_101[A_firstFree_953] = obj_204; A_firstFree_953 = (A_firstFree_953 + 1); A_typeId_183[obj_204] = 0; }; } function dispatch_A_destroyA114(integer this670) { if (A_typeId_183[this_670] == 0) { if (this_670 == 0) { error106("Nullpointer exception when calling A.A"); } else { error106("Called A.A on invalid object."); }; } else { }; destroyA172(this_670); }