Skip to content

Commit

Permalink
Show file/line/label in Com_Error messages when run out of memory in …
Browse files Browse the repository at this point in the history
…debug build.

git-svn-id: svn://svn.icculus.org/quake3/trunk@2206 edf5b092-35ff-0310-97b2-ce42778d08ea
  • Loading branch information
ztm committed Dec 8, 2011
1 parent 4a8223a commit 2386502
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions code/qcommon/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -966,12 +966,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) {
Expand Down Expand Up @@ -1724,8 +1728,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 ) {
Expand Down

0 comments on commit 2386502

Please sign in to comment.