summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZack Middleton <zturtleman@gmail.com>2011-12-08 22:25:25 +0000
committerTim Angus <tim@ngus.net>2013-01-12 20:16:45 +0000
commit6543d62a6d41d62071cac9434e6ba6c2ce875e8a (patch)
treec9977a0167d68870341f46bdba0c5135a4d9dd5c /src
parenta7c5f1075aeea47df7665b3a505aa2b70c6719e3 (diff)
Show file/line/label in Com_Error messages when run out of memory in debug build.
Diffstat (limited to 'src')
-rw-r--r--src/qcommon/common.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/qcommon/common.c b/src/qcommon/common.c
index c2d5d353..b35019a4 100644
--- a/src/qcommon/common.c
+++ b/src/qcommon/common.c
@@ -962,12 +962,16 @@ void *Z_TagMalloc( int size, int tag ) {
do {
if (rover == start) {
+ // scaned all the way around the list
#ifdef ZONE_DEBUG
Z_LogHeap();
-#endif
- // scaned all the way around the list
- Com_Error( ERR_FATAL, "Z_Malloc: failed on allocation of %i bytes from the %s zone",
+
+ Com_Error(ERR_FATAL, "Z_Malloc: failed on allocation of %i bytes from the %s zone: %s, line: %d (%s)",
+ size, zone == smallzone ? "small" : "main", file, line, label);
+#else
+ Com_Error(ERR_FATAL, "Z_Malloc: failed on allocation of %i bytes from the %s zone",
size, zone == smallzone ? "small" : "main");
+#endif
return NULL;
}
if (rover->tag) {
@@ -1720,8 +1724,11 @@ void *Hunk_Alloc( int size, ha_pref preference ) {
#ifdef HUNK_DEBUG
Hunk_Log();
Hunk_SmallLog();
+
+ Com_Error(ERR_DROP, "Hunk_Alloc failed on %i: %s, line: %d (%s)", size, file, line, label);
+#else
+ Com_Error(ERR_DROP, "Hunk_Alloc failed on %i", size);
#endif
- Com_Error( ERR_DROP, "Hunk_Alloc failed on %i", size );
}
if ( hunk_permanent == &hunk_low ) {