Merge pull request #1820 from hobostay/fix-tracking-allocator-stats

Fix TrackingAllocator reallocation_count being incremented on failed operations
This commit is contained in:
Karl Seguin authored and GitHub committed 2026-03-14 15:48:13 +08:00
commit 39d5a25258
1 file changed
+2 -2
+2 -2
View File
@@ -501,7 +501,7 @@ pub const TrackingAllocator = struct {
defer self.mutex.unlock();
const result = self.parent_allocator.rawResize(old_mem, alignment, new_len, ra);
self.reallocation_count += 1; // TODO: only if result is not null?
if (result) self.reallocation_count += 1;
return result;
}
@@ -531,7 +531,7 @@ pub const TrackingAllocator = struct {
defer self.mutex.unlock();
const result = self.parent_allocator.rawRemap(memory, alignment, new_len, ret_addr);
self.reallocation_count += 1; // TODO: only if result is not null?
if (result != null) self.reallocation_count += 1;
return result;
}
};