Changeset 21302 for trunk/src/kernel32/heapshared.cpp
- Timestamp:
- Jun 18, 2009, 11:53:26 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/heapshared.cpp
r9667 r21302 17 17 #define INCL_BASE 18 18 #define INCL_DOSMEMMGR 19 #define INCL_DOSPROCESS 19 20 #include <os2wrap.h> 20 21 #include <string.h> 21 22 #include <dbglog.h> 22 #include <heapshared.h> 23 #include <stddef.h> 24 #include <stdlib.h> 25 #include <umalloc.h> 23 26 #include "initterm.h" 27 28 #define PAGE_SIZE 4096 24 29 25 30 #define DBG_LOCALLOG DBG_heapshared … … 102 107 //****************************************************************************** 103 108 //****************************************************************************** 109 #ifdef DEBUG 110 int _LNK_CONV callback_function(const void *pentry, size_t sz, int useflag, int status, 111 const char *filename, size_t line) 112 { 113 if (_HEAPOK != status) { 114 dprintf(("status is not _HEAPOK.")); 115 return 1; 116 } 117 if (_USEDENTRY == useflag && sz && filename && line) { 118 dprintf(("allocated %08x %u at %s %d\n", pentry, sz, filename, line)); 119 } 120 else dprintf(("allocated %08x %u", pentry, sz)); 121 122 return 0; 123 } 124 #endif 125 //****************************************************************************** 126 //****************************************************************************** 104 127 void SYSTEM DestroySharedHeap() 105 128 { … … 108 131 return; 109 132 } 133 134 #ifdef DEBUG 135 _uheap_walk(sharedHeap, callback_function); 136 dprintf((NULL)); 137 #endif 138 110 139 if(--refCount == 0) { 111 140 if(sharedHeap) { … … 200 229 201 230 chunk = _umalloc(sharedHeap, size); 202 dprintf 2(("_smalloc %x returned %x", size, chunk));231 dprintf(("_smalloc %x returned %x", size, chunk)); 203 232 return chunk; 204 233 } … … 213 242 memset(chunk, 0, size); 214 243 } 215 dprintf2(("_smallocfill %x %x returned %x", size, filler, chunk)); 216 return chunk; 217 } 218 //****************************************************************************** 219 //****************************************************************************** 244 dprintf(("_smallocfill %x %x returned %x", size, filler, chunk)); 245 return chunk; 246 } 247 //****************************************************************************** 248 //****************************************************************************** 249 void SYSTEM _sfree(void *block) 250 { 251 dprintf(("_sfree %x", block)); 252 free(block); 253 } 254 //****************************************************************************** 255 //****************************************************************************** 256 void * _System _debug_smalloc(int size, char *pszFile, int linenr) 257 { 258 void *chunk; 259 260 #ifdef __DEBUG_ALLOC__ 261 chunk = _debug_umalloc(sharedHeap, size, pszFile, linenr); 262 #else 263 chunk = _umalloc(sharedHeap, size); 264 #endif 265 dprintf(("_smalloc %x returned %x", size, chunk)); 266 return chunk; 267 } 268 //****************************************************************************** 269 //****************************************************************************** 270 void * _System _debug_smallocfill(int size, int filler, char *pszFile, int linenr) 271 { 272 void *chunk; 273 274 #ifdef __DEBUG_ALLOC__ 275 chunk = _debug_umalloc(sharedHeap, size, pszFile, linenr); 276 #else 277 chunk = _umalloc(sharedHeap, size); 278 #endif 279 if(chunk) { 280 memset(chunk, 0, size); 281 } 282 dprintf(("_smallocfill %x %x returned %x", size, filler, chunk)); 283 return chunk; 284 } 285 //****************************************************************************** 286 //****************************************************************************** 287 void _System _debug_sfree(void *chunk, char *pszFile, int linenr) 288 { 289 dprintf(("_sfree %x", chunk)); 290 #ifdef __DEBUG_ALLOC__ 291 _debug_free(chunk, pszFile, linenr); 292 #else 293 free(chunk); 294 #endif 295 } 296 //****************************************************************************** 297 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.