mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Track heap->real_size for USE_TRACKED_ALLOC
This commit is contained in:
@@ -2411,6 +2411,7 @@ ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, bool full, bool silent)
|
||||
}
|
||||
#if ZEND_MM_STAT
|
||||
heap->size = 0;
|
||||
heap->real_size = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2977,6 +2978,7 @@ static void *tracked_malloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC
|
||||
tracked_add(heap, ptr, size);
|
||||
#if ZEND_MM_STAT
|
||||
heap->size += size;
|
||||
heap->real_size = heap->size;
|
||||
#endif
|
||||
return ptr;
|
||||
}
|
||||
@@ -2990,6 +2992,7 @@ static void tracked_free(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) {
|
||||
zval *size_zv = tracked_get_size_zv(heap, ptr);
|
||||
#if ZEND_MM_STAT
|
||||
heap->size -= Z_LVAL_P(size_zv);
|
||||
heap->real_size = heap->size;
|
||||
#endif
|
||||
zend_hash_del_bucket(heap->tracked_allocs, (Bucket *) size_zv);
|
||||
free(ptr);
|
||||
@@ -3017,6 +3020,7 @@ static void *tracked_realloc(void *ptr, size_t new_size ZEND_FILE_LINE_DC ZEND_F
|
||||
tracked_add(heap, ptr, new_size);
|
||||
#if ZEND_MM_STAT
|
||||
heap->size += new_size - old_size;
|
||||
heap->real_size = heap->size;
|
||||
#endif
|
||||
return ptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user