summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-30 20:07:15 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-30 20:07:15 +0300
commitf5ed6062017598fbdf9c3a7e4c53b5eeeddfe3ad (patch)
tree4fb1bd61cc2ea8013cddc2e8da17fc7fe1057c7a
parent8b984259c0d7d7af5394defc89a3b64d7b479425 (diff)
downloadmanaverse-f5ed6062017598fbdf9c3a7e4c53b5eeeddfe3ad.tar.gz
manaverse-f5ed6062017598fbdf9c3a7e4c53b5eeeddfe3ad.tar.bz2
manaverse-f5ed6062017598fbdf9c3a7e4c53b5eeeddfe3ad.tar.xz
manaverse-f5ed6062017598fbdf9c3a7e4c53b5eeeddfe3ad.zip
Improve debuging resource allocation.
-rw-r--r--src/commandhandler.cpp14
-rw-r--r--src/localconsts.h1
-rw-r--r--src/resources/resourcemanager.cpp13
3 files changed, 16 insertions, 12 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 6140b398e..d17d2b636 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -1260,13 +1260,19 @@ void showRes(std::string str, ResourceManager::Resources *res)
else
iter->second->setDumped(true);
- if (dynamic_cast<SubImage*>(iter->second))
+ SubImage *const subImage = dynamic_cast<SubImage *const>(
+ iter->second);
+ Image *const image = dynamic_cast<Image *const>(iter->second);
+ int id = 0;
+ if (subImage)
type = "S";
- else if (dynamic_cast<Image*>(iter->second))
+ else if (image)
type = "I";
- logger->log("Resource %s%s: %s (%d)", type.c_str(),
+ if (image)
+ id = image->getGLImage();
+ logger->log("Resource %s%s: %s (%d) id=%d", type.c_str(),
isNew.c_str(), iter->second->getIdPath().c_str(),
- iter->second->getRefCount());
+ iter->second->getRefCount(), id);
}
++ iter;
}
diff --git a/src/localconsts.h b/src/localconsts.h
index 947099668..8b8af420e 100644
--- a/src/localconsts.h
+++ b/src/localconsts.h
@@ -49,3 +49,4 @@
//#define DEBUG_BIND_TEXTURE 1
//#define DISABLE_RESOURCE_CACHING 1
#define DUMP_LEAKED_RESOURCES 1
+//#define DEBUG_DUMP_LEAKS1 1
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index e479a9609..71b5e9a1d 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -241,23 +241,20 @@ void ResourceManager::logResource(const Resource *const res)
src += " " + toString(count);
if (image && image->getGLImage())
{
- logger->log("ResourceManager::release(%s, %u) %s",
- res->mIdPath.c_str(), image->getGLImage(),
- src.c_str());
+ logger->log("resource(%s, %u) %s", res->mIdPath.c_str(),
+ image->getGLImage(), src.c_str());
}
else
{
- logger->log("ResourceManager::release(%s) %s",
- res->mIdPath.c_str(), src.c_str());
+ logger->log("resource(%s) %s", res->mIdPath.c_str(), src.c_str());
}
}
else
{
- logger->log("ResourceManager::release(%s)",
- res->mIdPath.c_str());
+ logger->log("resource(%s)", res->mIdPath.c_str());
}
#else
- logger->log("ResourceManager::release(%s)", res->mIdPath.c_str());
+ logger->log("resource(%s)", res->mIdPath.c_str());
#endif
}