Changeset 7627 for trunk/src/odincrt/malloc.cpp
- Timestamp:
- Dec 13, 2001, 4:32:57 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/odincrt/malloc.cpp
r5090 r7627 1 /* $Id: malloc.cpp,v 1. 5 2001-02-11 10:32:51sandervl Exp $ */1 /* $Id: malloc.cpp,v 1.6 2001-12-13 15:32:17 sandervl Exp $ */ 2 2 /* 3 3 * Project Odin Software License can be found in LICENSE.TXT … … 20 20 void * _IMPORT _LNK_CONV _debug_ucalloc(Heap_t , size_t, size_t ,const char *,size_t); 21 21 22 #ifdef DEBUG 23 unsigned long nrcalls_malloc = 0; 24 unsigned long nrcalls_free = 0; 25 unsigned long totalmemalloc = 0; 26 27 void _LNK_CONV getcrtstat(unsigned long *pnrcalls_malloc, 28 unsigned long *pnrcalls_free, 29 unsigned long *ptotalmemalloc) 30 { 31 *pnrcalls_malloc = nrcalls_malloc; 32 *pnrcalls_free = nrcalls_free; 33 *ptotalmemalloc = totalmemalloc; 34 } 35 #endif 36 22 37 void * _LNK_CONV os2calloc( size_t a, size_t b ) 23 38 { … … 25 40 void *rc; 26 41 42 #ifdef DEBUG 43 totalmemalloc += a*b; 44 nrcalls_malloc++; 45 #endif 27 46 rc = calloc(a,b); 28 47 SetFS(sel); … … 34 53 unsigned short sel = RestoreOS2FS(); 35 54 55 #ifdef DEBUG 56 nrcalls_free++; 57 totalmemalloc -= _msize(a); 58 #endif 36 59 free(a); 37 60 SetFS(sel); … … 43 66 void *rc; 44 67 68 69 #ifdef DEBUG 70 totalmemalloc += a; 71 nrcalls_malloc++; 72 #endif 45 73 rc = malloc(a); 46 74 SetFS(sel); … … 53 81 void *rc; 54 82 83 #ifdef DEBUG 84 totalmemalloc += (b - _msize(a)); 85 #endif 86 55 87 rc = realloc(a, b); 56 88 SetFS(sel); … … 63 95 void *rc; 64 96 97 #ifdef DEBUG 98 totalmemalloc += a*b; 99 nrcalls_malloc++; 100 #endif 101 65 102 rc = _debug_calloc(a,b,c,d); 66 103 SetFS(sel); … … 72 109 unsigned short sel = RestoreOS2FS(); 73 110 111 112 #ifdef DEBUG 113 nrcalls_free++; 114 totalmemalloc -= _msize(a); 115 #endif 74 116 _debug_free(a,b,c); 75 117 SetFS(sel); … … 81 123 void *rc; 82 124 125 #ifdef DEBUG 126 totalmemalloc += a; 127 nrcalls_malloc++; 128 #endif 83 129 rc = _debug_calloc(1,a,b,c); 84 130 SetFS(sel); … … 91 137 void *rc; 92 138 139 #ifdef DEBUG 140 totalmemalloc += (b - _msize(a)); 141 #endif 93 142 rc = _debug_realloc(a,b,c,d); 94 143 SetFS(sel); … … 101 150 void *rc; 102 151 152 #ifdef DEBUG 153 totalmemalloc += b; 154 nrcalls_malloc++; 155 #endif 103 156 rc = _umalloc(a,b); 104 157 SetFS(sel); … … 111 164 void *rc; 112 165 166 #ifdef DEBUG 167 totalmemalloc += b*c; 168 nrcalls_malloc++; 169 #endif 113 170 rc = _ucalloc(a,b,c); 114 171 SetFS(sel); … … 121 178 void *rc; 122 179 180 #ifdef DEBUG 181 totalmemalloc += b; 182 nrcalls_malloc++; 183 #endif 123 184 rc = _debug_ucalloc(a, 1, b,c,d); 124 185 SetFS(sel); … … 131 192 void *rc; 132 193 194 #ifdef DEBUG 195 totalmemalloc += b*c; 196 nrcalls_malloc++; 197 #endif 133 198 rc = _debug_ucalloc(a,b,c,d,e); 134 199 SetFS(sel);
Note:
See TracChangeset
for help on using the changeset viewer.