Lines Matching defs:size
121 #define PRINT_REALLOC(name, cnt, size, ptr) { \
124 PrintHex(size, 10); \
128 #define PRINT_ALLOC(name, cnt, size, ptr) { \
131 PrintHex(size, 10); \
144 #define PRINT_ALLOC(name, cnt, size, ptr)
158 realloc(NULL, size) : the call is equivalent to malloc(size)
168 void *MyAlloc(size_t size)
170 if (size == 0)
172 // PRINT_ALLOC("Alloc ", g_allocCount, size, NULL)
175 void *p = malloc(size);
178 PRINT_ALLOC("Alloc ", g_allocCount, size, p)
183 return malloc(size);
194 void *MyRealloc(void *address, size_t size)
196 if (size == 0)
201 // PRINT_REALLOC("Realloc ", g_allocCount, size, address)
204 void *p = realloc(address, size);
207 PRINT_REALLOC("Realloc ", g_allocCount, size, address)
212 return realloc(address, size);
219 void *MidAlloc(size_t size)
221 if (size == 0)
225 void *p = VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
228 PRINT_ALLOC("Alloc-Mid", g_allocCountMid, size, p)
233 return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
262 SIZE_T size;
269 size = fn();
270 if (size == 0 || (size & (size - 1)) != 0)
272 g_LargePageSize = size;
278 void *BigAlloc(size_t size)
280 if (size == 0)
283 PRINT_ALLOC("Alloc-Big", g_allocCountBig, size, NULL)
288 if (ps != 0 && ps <= (1 << 30) && size > (ps / 2))
292 size2 = (size + ps) & ~ps;
293 if (size2 >= size)
306 return MidAlloc(size);
318 static void *SzAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p) return MyAlloc(size); }
323 static void *SzMidAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p) return MidAlloc(size); }
325 static void *SzBigAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p) return BigAlloc(size); }
377 static int posix_memalign(void **ptr, size_t align, size_t size)
379 size_t newSize = size + align;
383 if (newSize < size)
402 static void *SzAlignedAlloc(ISzAllocPtr pp, size_t size)
414 newSize = size + ALLOC_ALIGN_SIZE * 1 + ADJUST_ALLOC_SIZE;
415 if (newSize < size)
424 Print(" size="); PrintHex(size, 8);
438 if (posix_memalign(&p, ALLOC_ALIGN_SIZE, size))
474 static void *AlignOffsetAlloc_Alloc(ISzAllocPtr pp, size_t size)
492 newSize = size + alignSize + extra + ADJUST_ALLOC_SIZE;
493 if (newSize < size)
506 Print(" size="); PrintHex(size, 8);