[svn:parrot] r40229 - trunk/src/gc
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Thu Jul 23 19:21:24 UTC 2009
Author: NotFound
Date: Thu Jul 23 19:21:22 2009
New Revision: 40229
URL: https://trac.parrot.org/parrot/changeset/40229
Log:
[cage] show size in Out of mem panics
Modified:
trunk/src/gc/alloc_memory.c
Modified: trunk/src/gc/alloc_memory.c
==============================================================================
--- trunk/src/gc/alloc_memory.c Thu Jul 23 15:44:54 2009 (r40228)
+++ trunk/src/gc/alloc_memory.c Thu Jul 23 19:21:22 2009 (r40229)
@@ -24,6 +24,15 @@
#include "parrot/parrot.h"
#include "parrot/memory.h"
+PARROT_DOES_NOT_RETURN
+static void failed_allocation(unsigned int line, unsigned long size) /* HEADERIZER SKIP */
+{
+ fprintf(stderr, "Failed allocation of %ul bytes\n", size);
+ do_panic(NULL, "Out of mem", __FILE__, line);
+}
+
+#define PANIC_OUT_OF_MEM(size) failed_allocation(__LINE__, (size))
+
/* HEADERIZER HFILE: include/parrot/memory.h */
/*
@@ -49,7 +58,7 @@
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
if (!ptr)
- PANIC(NULL, "Out of mem");
+ PANIC_OUT_OF_MEM(size);
return ptr;
}
@@ -80,7 +89,7 @@
UNUSED(line);
#endif
if (!ptr)
- PANIC(NULL, "Out of mem");
+ PANIC_OUT_OF_MEM(size);
return ptr;
}
@@ -107,7 +116,7 @@
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
if (!ptr)
- PANIC(NULL, "Out of mem");
+ PANIC_OUT_OF_MEM(size);
return ptr;
}
@@ -139,7 +148,7 @@
UNUSED(line);
#endif
if (!ptr)
- PANIC(NULL, "Out of mem");
+ PANIC_OUT_OF_MEM(size);
return ptr;
}
@@ -174,7 +183,7 @@
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
if (!ptr)
- PANIC(NULL, "Out of mem");
+ PANIC_OUT_OF_MEM(size);
return ptr;
}
@@ -207,7 +216,7 @@
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
if (!ptr)
- PANIC(NULL, "Out of mem");
+ PANIC_OUT_OF_MEM(size);
if (size > old_size)
memset((char*)ptr + old_size, 0, size - old_size);
@@ -247,7 +256,7 @@
UNUSED(line);
#endif
if (!ptr)
- PANIC(NULL, "Out of mem");
+ PANIC_OUT_OF_MEM(size);
return ptr;
}
@@ -285,7 +294,7 @@
UNUSED(line);
# endif
if (!ptr)
- PANIC(NULL, "Out of mem");
+ PANIC_OUT_OF_MEM(size);
if (size > old_size)
memset((char*)ptr + old_size, 0, size - old_size);
More information about the parrot-commits
mailing list