Skip to content

Commit

Permalink
[cocos2dx] Closes #2505, fix warning about memory allocated by Cococs…
Browse files Browse the repository at this point in the history
…2d-X
  • Loading branch information
badlogic committed Apr 30, 2024
1 parent f67807f commit 9c9bcb9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion spine-cpp/spine-cpp/include/spine/Debug.h
Expand Up @@ -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() {
Expand Down

0 comments on commit 9c9bcb9

Please sign in to comment.