mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Track heap->real_size for USE_TRACKED_ALLOC
This commit is contained in:
commit
7841c8a3df
1 changed files with 4 additions and 0 deletions
|
@ -2276,6 +2276,7 @@ void zend_mm_shutdown(zend_mm_heap *heap, bool full, bool silent)
|
|||
heap->custom_heap.std._free = free;
|
||||
}
|
||||
heap->size = 0;
|
||||
heap->real_size = 0;
|
||||
}
|
||||
|
||||
if (full) {
|
||||
|
@ -2836,6 +2837,7 @@ static void *tracked_malloc(size_t size)
|
|||
|
||||
tracked_add(heap, ptr, size);
|
||||
heap->size += size;
|
||||
heap->real_size = heap->size;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
@ -2847,6 +2849,7 @@ static void tracked_free(void *ptr) {
|
|||
zend_mm_heap *heap = AG(mm_heap);
|
||||
zval *size_zv = tracked_get_size_zv(heap, ptr);
|
||||
heap->size -= Z_LVAL_P(size_zv);
|
||||
heap->real_size = heap->size;
|
||||
zend_hash_del_bucket(heap->tracked_allocs, (Bucket *) size_zv);
|
||||
free(ptr);
|
||||
}
|
||||
|
@ -2872,6 +2875,7 @@ static void *tracked_realloc(void *ptr, size_t new_size) {
|
|||
ptr = __zend_realloc(ptr, new_size);
|
||||
tracked_add(heap, ptr, new_size);
|
||||
heap->size += new_size - old_size;
|
||||
heap->real_size = heap->size;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue