From 557ce7a841930ab78e53e91ae952916a5e72e033 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 4 Sep 2025 13:32:10 +0200 Subject: [PATCH] express: Fix track-memory-usage with DeletedBufferChain off mark_pointer gets called twice, which is now legal --- panda/src/express/memoryUsage.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/panda/src/express/memoryUsage.cxx b/panda/src/express/memoryUsage.cxx index 21161a025b..d5a7bb4a72 100644 --- a/panda/src/express/memoryUsage.cxx +++ b/panda/src/express/memoryUsage.cxx @@ -826,7 +826,8 @@ ns_record_void_pointer(void *ptr, size_t size) { if (_track_memory_usage) { if (express_cat.is_spam()) { express_cat.spam() - << "Recording void pointer " << (void *)ptr << "\n"; + << "Recording void pointer " << (void *)ptr + << " with size " << size << "\n"; } // We have to protect modifications to the table from recursive calls by @@ -846,11 +847,15 @@ ns_record_void_pointer(void *ptr, size_t size) { MemoryInfo *info = (*insert_result.first).second; - // We shouldn't already have a void pointer. + // If we already have a void pointer, that's okay, as long as the size + // matches. if (info->_void_ptr != nullptr) { - express_cat.error() - << "Void pointer " << (void *)ptr << " recorded twice!\n"; - nassertv(false); + if (info->_size != size) { + express_cat.error() + << "Void pointer " << (void *)ptr + << " was already recorded with size " << size << "!\n"; + nassertv(false); + } } if (info->_freeze_index == _freeze_index) {