diff options
Diffstat (limited to 'src/resources/resourcemanager.cpp')
-rw-r--r-- | src/resources/resourcemanager.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index 366460a6b..54ffe2d8e 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -36,6 +36,7 @@ #endif // USE_OPENGL #include "resources/imagehelper.h" #include "resources/imageset.h" +#include "resources/memorymanager.h" #include "resources/sdlmusic.h" #include "resources/soundeffect.h" @@ -1065,3 +1066,33 @@ void ResourceManager::clearCache() while (cleanOrphans(true)) continue; } + +int ResourceManager::calcMemoryLocal() +{ + int sz = sizeof(ResourceManager); + FOR_EACH (std::set<SDL_Surface*>::iterator, it, deletedSurfaces) + { + sz += memoryManager.getSurfaceSize(*it); + } + return sz; +} + +int ResourceManager::calcMemoryChilds(const int level) +{ + int sz = 0; + FOR_EACH (ResourceIterator, it, mResources) + { + sz += (*it).first.capacity(); + sz += (*it).second->calcMemory(level + 1); + } + FOR_EACH (ResourceIterator, it, mOrphanedResources) + { + sz += (*it).first.capacity(); + sz += (*it).second->calcMemory(level + 1); + } + FOR_EACH (std::set<Resource*>::iterator, it, mDeletedResources) + { + sz += (*it)->calcMemory(level + 1); + } + return sz; +} |