Lines Matching refs:size

153 …_segment* zend_mm_mem_mmap_realloc(zend_mm_storage *storage, zend_mm_segment* segment, size_t size)  in zend_mm_mem_mmap_realloc()  argument
159 ret = (zend_mm_segment*)mremap(segment, segment->size, segment, size, MREMAP_MAYMOVE); in zend_mm_mem_mmap_realloc()
161 ret = (zend_mm_segment*)mremap(segment, segment->size, size, MREMAP_MAYMOVE); in zend_mm_mem_mmap_realloc()
165 ret = storage->handlers->_alloc(storage, size); in zend_mm_mem_mmap_realloc()
167 memcpy(ret, segment, size > segment->size ? segment->size : size); in zend_mm_mem_mmap_realloc()
178 munmap((void*)segment, segment->size); in zend_mm_mem_mmap_free()
185 static zend_mm_segment* zend_mm_mem_mmap_anon_alloc(zend_mm_storage *storage, size_t size) in zend_mm_mem_mmap_anon_alloc() argument
187 …zend_mm_segment *ret = (zend_mm_segment*)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MA… in zend_mm_mem_mmap_anon_alloc()
220 static zend_mm_segment* zend_mm_mem_mmap_zero_alloc(zend_mm_storage *storage, size_t size) in zend_mm_mem_mmap_zero_alloc() argument
222 …zend_mm_segment *ret = (zend_mm_segment*)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, zen… in zend_mm_mem_mmap_zero_alloc()
264 static zend_mm_segment* zend_mm_mem_win32_alloc(zend_mm_storage *storage, size_t size) in zend_mm_mem_win32_alloc() argument
266 return (zend_mm_segment*) HeapAlloc((HANDLE)storage->data, HEAP_NO_SERIALIZE, size); in zend_mm_mem_win32_alloc()
274 …segment* zend_mm_mem_win32_realloc(zend_mm_storage *storage, zend_mm_segment* segment, size_t size) in zend_mm_mem_win32_realloc() argument
276 return (zend_mm_segment*) HeapReAlloc((HANDLE)storage->data, HEAP_NO_SERIALIZE, segment, size); in zend_mm_mem_win32_realloc()
285 static zend_mm_segment* zend_mm_mem_malloc_alloc(zend_mm_storage *storage, size_t size) in zend_mm_mem_malloc_alloc() argument
287 return (zend_mm_segment*)malloc(size); in zend_mm_mem_malloc_alloc()
290 …mm_segment* zend_mm_mem_malloc_realloc(zend_mm_storage *storage, zend_mm_segment *ptr, size_t size) in zend_mm_mem_malloc_realloc() argument
292 return (zend_mm_segment*)realloc(ptr, size); in zend_mm_mem_malloc_realloc()
321 # define ZEND_MM_STORAGE_ALLOC(size) heap->storage->handlers->_alloc(heap->storage, size) argument
322 # define ZEND_MM_STORAGE_REALLOC(ptr, size) heap->storage->handlers->_realloc(heap->storage, ptr,… argument
351 size_t size; member
360 size_t size; member
429 size_t size; member
497 #define ZEND_MM_BLOCK(b, type, size) do { \ argument
498 size_t _size = (size); \
534 #define ZEND_MM_TRUE_SIZE(size) ((size<ZEND_MM_MIN_SIZE)?(ZEND_MM_ALIGNED_MIN_HEADER_SIZE):(ZEND… argument
608 (((char*)(ZEND_MM_DATA_OF(block))) + ((zend_mm_block*)(block))->debug.size)
614 ((zend_mm_block*)(block))->debug.size = (__size); \
627 ((zend_mm_block*)(block))->debug.size = (_size)
656 static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_OR…
658 static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_F…
737 size_t size; in zend_mm_add_to_free_list() local
742 size = ZEND_MM_FREE_BLOCK_SIZE(mm_block); in zend_mm_add_to_free_list()
743 if (EXPECTED(!ZEND_MM_SMALL_SIZE(size))) { in zend_mm_add_to_free_list()
746 index = ZEND_MM_LARGE_BUCKET_INDEX(size); in zend_mm_add_to_free_list()
757 for (m = size << (ZEND_MM_NUM_BUCKETS - index); ; m <<= 1) { in zend_mm_add_to_free_list()
760 if (ZEND_MM_FREE_BLOCK_SIZE(prev) != size) { in zend_mm_add_to_free_list()
782 index = ZEND_MM_BUCKET_INDEX(size); in zend_mm_add_to_free_list()
901 heap->real_size -= segment->size; in zend_mm_del_segment()
915 size_t size = ZEND_MM_BLOCK_SIZE(mm_block); in zend_mm_free_cache() local
919 heap->cached -= size; in zend_mm_free_cache()
923 size += ZEND_MM_FREE_BLOCK_SIZE(mm_block); in zend_mm_free_cache()
927 size += ZEND_MM_FREE_BLOCK_SIZE(next_block); in zend_mm_free_cache()
930 ZEND_MM_BLOCK(mm_block, ZEND_MM_FREE_BLOCK, size); in zend_mm_free_cache()
951 static void zend_mm_random(unsigned char *buf, size_t size) /* {{{ */ in zend_mm_random() argument
973 BOOL ret = CryptGenRandom(hCryptProv, size, buf); in zend_mm_random()
976 while (i < size && buf[i] != 0) { in zend_mm_random()
979 if (i == size) { in zend_mm_random()
989 if (read(fd, buf, size) == size) { in zend_mm_random()
990 while (i < size && buf[i] != 0) { in zend_mm_random()
993 if (i == size) { in zend_mm_random()
1002 while (i < size) { in zend_mm_random()
1094 heap->size = 0; in zend_mm_startup_ex()
1225 (char*)q > (char*)segment + segment->size || in zend_mm_find_leaks()
1261 (char*)q > (char*)segment + segment->size || in zend_mm_check_leaks()
1273 leak.size = p->debug.size; in zend_mm_check_leaks()
1411 …put("OK (allocated on %s:%d, %d bytes)\n", p->debug.filename, p->debug.lineno, (int)p->debug.size); in zend_mm_check_ptr()
1545 (char*)q > (char*)segment + segment->size || in zend_mm_check_heap()
1597 size_t size, true_size, min_size, max_size; in zend_mm_shutdown() local
1601 size = 0; in zend_mm_shutdown()
1603 true_size = ZEND_MM_TRUE_SIZE(size); in zend_mm_shutdown()
1605 min_size = size; in zend_mm_shutdown()
1607 size++; in zend_mm_shutdown()
1609 true_size = ZEND_MM_TRUE_SIZE(size); in zend_mm_shutdown()
1613 max_size = size-1; in zend_mm_shutdown()
1617 max_size = size-1; in zend_mm_shutdown()
1620 size++; in zend_mm_shutdown()
1664 heap->size = 0; in zend_mm_shutdown()
1680 size_t size) in zend_mm_safe_error() argument
1712 size); in zend_mm_safe_error()
1723 size); in zend_mm_safe_error()
1810 static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_OR… in _zend_mm_alloc_int()
1813 size_t true_size = ZEND_MM_TRUE_SIZE(size); in _zend_mm_alloc_int()
1824 if (UNEXPECTED(true_size < size)) { in _zend_mm_alloc_int()
1838 ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 0); in _zend_mm_alloc_int()
1902 …austed at %s:%d (tried to allocate %lu bytes)", heap->limit, __zend_filename, __zend_lineno, size); in _zend_mm_alloc_int()
1904 …ap, "Allowed memory size of %ld bytes exhausted (tried to allocate %lu bytes)", heap->limit, size); in _zend_mm_alloc_int()
1918 …d) at %s:%d (tried to allocate %lu bytes)", heap->real_size, __zend_filename, __zend_lineno, size); in _zend_mm_alloc_int()
1920 …_error(heap, "Out of memory (allocated %ld) (tried to allocate %lu bytes)", heap->real_size, size); in _zend_mm_alloc_int()
1930 segment->size = segment_size; in _zend_mm_alloc_int()
1974 ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 1); in _zend_mm_alloc_int()
1976 heap->size += true_size; in _zend_mm_alloc_int()
1977 if (heap->peak < heap->size) { in _zend_mm_alloc_int()
1978 heap->peak = heap->size; in _zend_mm_alloc_int()
1991 size_t size; in _zend_mm_free_int() local
1998 size = ZEND_MM_BLOCK_SIZE(mm_block); in _zend_mm_free_int()
2002 memset(ZEND_MM_DATA_OF(mm_block), 0x5a, mm_block->debug.size); in _zend_mm_free_int()
2006 if (EXPECTED(ZEND_MM_SMALL_SIZE(size)) && EXPECTED(heap->cached < ZEND_MM_CACHE_SIZE)) { in _zend_mm_free_int()
2007 size_t index = ZEND_MM_BUCKET_INDEX(size); in _zend_mm_free_int()
2012 heap->cached += size; in _zend_mm_free_int()
2025 heap->size -= size; in _zend_mm_free_int()
2027 next_block = ZEND_MM_BLOCK_AT(mm_block, size); in _zend_mm_free_int()
2030 size += ZEND_MM_FREE_BLOCK_SIZE(next_block); in _zend_mm_free_int()
2035 size += ZEND_MM_FREE_BLOCK_SIZE(mm_block); in _zend_mm_free_int()
2038 ZEND_MM_IS_GUARD_BLOCK(ZEND_MM_BLOCK_AT(mm_block, size))) { in _zend_mm_free_int()
2041 ZEND_MM_BLOCK(mm_block, ZEND_MM_FREE_BLOCK, size); in _zend_mm_free_int()
2047 static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_F… in _zend_mm_realloc_int()
2056 return _zend_mm_alloc_int(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); in _zend_mm_realloc_int()
2059 true_size = ZEND_MM_TRUE_SIZE(size); in _zend_mm_realloc_int()
2063 if (UNEXPECTED(true_size < size)) { in _zend_mm_realloc_int()
2088 heap->size += (true_size - orig_size); in _zend_mm_realloc_int()
2091 ZEND_MM_SET_DEBUG_INFO(mm_block, size, 0, 0); in _zend_mm_realloc_int()
2110 ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 0); in _zend_mm_realloc_int()
2115 memcpy(ptr, p, mm_block->debug.size); in _zend_mm_realloc_int()
2170 ZEND_MM_SET_DEBUG_INFO(mm_block, size, 0, 0); in _zend_mm_realloc_int()
2171 heap->size = heap->size + true_size - orig_size; in _zend_mm_realloc_int()
2172 if (heap->peak < heap->size) { in _zend_mm_realloc_int()
2173 heap->peak = heap->size; in _zend_mm_realloc_int()
2202 heap->real_size + segment_size - segment_copy->size > heap->limit) { in _zend_mm_realloc_int()
2211 …austed at %s:%d (tried to allocate %ld bytes)", heap->limit, __zend_filename, __zend_lineno, size); in _zend_mm_realloc_int()
2213 …ap, "Allowed memory size of %ld bytes exhausted (tried to allocate %ld bytes)", heap->limit, size); in _zend_mm_realloc_int()
2226 …d) at %s:%d (tried to allocate %ld bytes)", heap->real_size, __zend_filename, __zend_lineno, size); in _zend_mm_realloc_int()
2228 …_error(heap, "Out of memory (allocated %ld) (tried to allocate %ld bytes)", heap->real_size, size); in _zend_mm_realloc_int()
2232 heap->real_size += segment_size - segment->size; in _zend_mm_realloc_int()
2237 segment->size = segment_size; in _zend_mm_realloc_int()
2270 ZEND_MM_SET_DEBUG_INFO(mm_block, size, 1, 1); in _zend_mm_realloc_int()
2272 heap->size = heap->size + true_size - orig_size; in _zend_mm_realloc_int()
2273 if (heap->peak < heap->size) { in _zend_mm_realloc_int()
2274 heap->peak = heap->size; in _zend_mm_realloc_int()
2281 ptr = _zend_mm_alloc_int(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); in _zend_mm_realloc_int()
2283 memcpy(ptr, p, mm_block->debug.size); in _zend_mm_realloc_int()
2291 ZEND_API void *_zend_mm_alloc(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG… in _zend_mm_alloc()
2293 return _zend_mm_alloc_int(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); in _zend_mm_alloc()
2301 ZEND_API void *_zend_mm_realloc(zend_mm_heap *heap, void *ptr, size_t size ZEND_FILE_LINE_DC ZEND_F… in _zend_mm_realloc()
2303 return _zend_mm_realloc_int(heap, ptr, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); in _zend_mm_realloc()
2316 return mm_block->debug.size; in _zend_mm_block_size()
2343 ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) in _emalloc()
2348 return AG(mm_heap)->_malloc(size); in _emalloc()
2350 return _zend_mm_alloc_int(AG(mm_heap), size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); in _emalloc()
2364 ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE… in _erealloc() argument
2369 return AG(mm_heap)->_realloc(ptr, size); in _erealloc()
2371 …return _zend_mm_realloc_int(AG(mm_heap), ptr, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_REL… in _erealloc()
2384 static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) in safe_address() argument
2392 "rm"(size), in safe_address()
2396 …(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset); in safe_address()
2404 static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) in safe_address() argument
2412 "rm"(size), in safe_address()
2416 …(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset); in safe_address()
2424 static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) in safe_address() argument
2426 zend_ulong64 res = (zend_ulong64)nmemb * (zend_ulong64)size + (zend_ulong64)offset; in safe_address()
2429 …(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset); in safe_address()
2437 static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) in safe_address() argument
2439 size_t res = nmemb * size + offset; in safe_address()
2440 double _d = (double)nmemb * (double)size + (double)offset; in safe_address()
2444 …(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset); in safe_address()
2452 ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_L… in _safe_emalloc() argument
2454 return emalloc_rel(safe_address(nmemb, size, offset)); in _safe_emalloc()
2457 ZEND_API void *_safe_malloc(size_t nmemb, size_t size, size_t offset) in _safe_malloc() argument
2459 return pemalloc(safe_address(nmemb, size, offset), 1); in _safe_malloc()
2462 ZEND_API void *_safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC… in _safe_erealloc() argument
2464 return erealloc_rel(ptr, safe_address(nmemb, size, offset)); in _safe_erealloc()
2467 ZEND_API void *_safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset) in _safe_realloc() argument
2469 return perealloc(ptr, safe_address(nmemb, size, offset), 1); in _safe_realloc()
2473 ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) in _ecalloc()
2477 p = _safe_emalloc(nmemb, size, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); in _ecalloc()
2481 memset(p, 0, size * nmemb); in _ecalloc()
2543 size_t usage = AG(mm_heap)->size; in zend_memory_usage()