|
From: Terry T. <ter...@us...> - 2005-03-21 02:43:22
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12682/Frontier/Common/source Modified Files: memory.c Log Message: Some preliminary fixes to support memory management debugging (MEMTRACKER = 1). More to come... Index: memory.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/memory.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** memory.c 11 Jan 2005 22:48:08 -0000 1.5 --- memory.c 21 Mar 2005 02:43:14 -0000 1.6 *************** *** 38,49 **** #define safetycushionsize 0x2800 /*10K*/ ! #ifdef fldebug ! long cttemphandles = 0; ! THz tempzone; ! #endif static Handle hsafetycushion = nil; /*a buffer to allow memory error reporting*/ --- 38,61 ---- #define safetycushionsize 0x2800 /*10K*/ ! // TRT - 20 Mar 2005 - 10.1a2 - only used for debugging on Mac OS ! #ifdef MACVERSION ! #ifdef fldebug ! long cttemphandles = 0; ! THz tempzone; + #endif + + #if (MEMTRACKER==1) + + // for real tracking need to implement these functions + #define debugaddmemhandle(h, ctbytes, filename, linenumber, threadid) + #define debugremovememhandle(h) + + #endif + + #endif static Handle hsafetycushion = nil; /*a buffer to allow memory error reporting*/ *************** *** 91,94 **** --- 103,113 ---- #ifdef MACVERSION + #if TARGET_API_MAC_CARBON == 1 + // TRT - 13 Mar 2005 - 10.1a2 + // There is no temp memory in Carbon or OS X so make sure + // we never ask for it. + fltemp = false; + #endif + if (fltemp) { /*try grabbing temp memory first*/ *************** *** 97,104 **** if (h != nil) { ! debugaddmemhandle (h, ctbytes, filename, linenumber, threadid); #ifdef fldebug ++cttemphandles; --- 116,127 ---- if (h != nil) { ! debugaddmemhandle(h, ctbytes, filename, linenumber, threadid); #ifdef fldebug + // again we can't have any temp handles so this + // code isn't useful + #if TARGET_API_MAC_CARBON == 0 + ++cttemphandles; *************** *** 107,110 **** --- 130,135 ---- #endif + #endif + return (h); } *************** *** 124,128 **** if (h != nil) ! debugaddmemhandle (h, ctbytes, filename, linenumber, threadid); #endif #ifdef WIN95VERSION --- 149,153 ---- if (h != nil) ! debugaddmemhandle(h, ctbytes, filename, linenumber, threadid); #endif #ifdef WIN95VERSION *************** *** 2636,2639 **** --- 2661,2669 ---- boolean initmemory (void) { + #if (MEMTRACKER == 1) + // TRT - 13 Mar 2005 - 10.1a2 + // Initialize memory debugging structures + #endif + shellpushmemoryhook (&safetycushionhook); |