Skip to content

Commit 0ee73cc

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Track heap->real_size for USE_TRACKED_ALLOC
2 parents bb6263a + dfc4caa commit 0ee73cc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Zend/zend_alloc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2411,6 +2411,7 @@ ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, bool full, bool silent)
24112411
}
24122412
#if ZEND_MM_STAT
24132413
heap->size = 0;
2414+
heap->real_size = 0;
24142415
#endif
24152416
}
24162417

@@ -2977,6 +2978,7 @@ static void *tracked_malloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC
29772978
tracked_add(heap, ptr, size);
29782979
#if ZEND_MM_STAT
29792980
heap->size += size;
2981+
heap->real_size = heap->size;
29802982
#endif
29812983
return ptr;
29822984
}
@@ -2990,6 +2992,7 @@ static void tracked_free(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) {
29902992
zval *size_zv = tracked_get_size_zv(heap, ptr);
29912993
#if ZEND_MM_STAT
29922994
heap->size -= Z_LVAL_P(size_zv);
2995+
heap->real_size = heap->size;
29932996
#endif
29942997
zend_hash_del_bucket(heap->tracked_allocs, (Bucket *) size_zv);
29952998
free(ptr);
@@ -3017,6 +3020,7 @@ static void *tracked_realloc(void *ptr, size_t new_size ZEND_FILE_LINE_DC ZEND_F
30173020
tracked_add(heap, ptr, new_size);
30183021
#if ZEND_MM_STAT
30193022
heap->size += new_size - old_size;
3023+
heap->real_size = heap->size;
30203024
#endif
30213025
return ptr;
30223026
}

0 commit comments

Comments
 (0)