From 9c9bcb9428d0c7481ec2f69c0403c2904f978d27 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Tue, 30 Apr 2024 10:55:51 +0200 Subject: [PATCH] [cocos2dx] Closes #2505, fix warning about memory allocated by Cococs2d-X --- spine-cpp/spine-cpp/include/spine/Debug.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spine-cpp/spine-cpp/include/spine/Debug.h b/spine-cpp/spine-cpp/include/spine/Debug.h index 9b8443dc3..1c5baec96 100644 --- a/spine-cpp/spine-cpp/include/spine/Debug.h +++ b/spine-cpp/spine-cpp/include/spine/Debug.h @@ -110,7 +110,15 @@ namespace spine { } virtual char *_readFile(const String &path, int *length) { - return _extension->_readFile(path, length); + auto data = _extension->_readFile(path, length); + + if (_allocated.count(data) == 0) { + _allocated[data] = Allocation(data, sizeof(char) * (*length), nullptr, 0); + _allocations++; + _usedMemory += sizeof(char) * (*length); + } + + return data; } size_t getUsedMemory() {