Skip to content

Commit feb1d63

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Track heap->real_size for USE_TRACKED_ALLOC
2 parents be70f42 + 0ee73cc commit feb1d63

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
@@ -2432,6 +2432,7 @@ ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, bool full, bool silent)
24322432
}
24332433
#if ZEND_MM_STAT
24342434
heap->size = 0;
2435+
heap->real_size = 0;
24352436
#endif
24362437
}
24372438

@@ -2999,6 +3000,7 @@ static void *tracked_malloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC
29993000
tracked_add(heap, ptr, size);
30003001
#if ZEND_MM_STAT
30013002
heap->size += size;
3003+
heap->real_size = heap->size;
30023004
#endif
30033005
return ptr;
30043006
}
@@ -3012,6 +3014,7 @@ static void tracked_free(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) {
30123014
zval *size_zv = tracked_get_size_zv(heap, ptr);
30133015
#if ZEND_MM_STAT
30143016
heap->size -= Z_LVAL_P(size_zv);
3017+
heap->real_size = heap->size;
30153018
#endif
30163019
zend_hash_del_bucket(heap->tracked_allocs, (Bucket *) size_zv);
30173020
free(ptr);
@@ -3039,6 +3042,7 @@ static void *tracked_realloc(void *ptr, size_t new_size ZEND_FILE_LINE_DC ZEND_F
30393042
tracked_add(heap, ptr, new_size);
30403043
#if ZEND_MM_STAT
30413044
heap->size += new_size - old_size;
3045+
heap->real_size = heap->size;
30423046
#endif
30433047
return ptr;
30443048
}

0 commit comments

Comments
 (0)