Author: lupus
Date: 2007-01-11 12:53:57 -0500 (Thu, 11 Jan 2007)
New Revision: 70868
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/mempool.c
Log:
Thu Jan 11 18:53:19 CET 2007 Paolo Molaro <[EMAIL PROTECTED]>
* mempool.c: added code to help debug mempool allocations.
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2007-01-11 17:41:40 UTC (rev 70867)
+++ trunk/mono/mono/metadata/ChangeLog 2007-01-11 17:53:57 UTC (rev 70868)
@@ -1,3 +1,8 @@
+
+Thu Jan 11 18:53:19 CET 2007 Paolo Molaro <[EMAIL PROTECTED]>
+
+ * mempool.c: added code to help debug mempool allocations.
+
2007-01-11 Dick Porter <[EMAIL PROTECTED]>
* socket-io.c (convert_sockopt_level_and_name): Add DontFragment
Modified: trunk/mono/mono/metadata/mempool.c
===================================================================
--- trunk/mono/mono/metadata/mempool.c 2007-01-11 17:41:40 UTC (rev 70867)
+++ trunk/mono/mono/metadata/mempool.c 2007-01-11 17:53:57 UTC (rev 70868)
@@ -130,6 +130,27 @@
}
}
+#ifdef TRACE_ALLOCATIONS
+#include <execinfo.h>
+#include "metadata/appdomain.h"
+#include "metadata/metadata-internals.h"
+
+static void
+mono_backtrace (int limit)
+{
+ void *array[limit];
+ char **names;
+ int i;
+ backtrace (array, limit);
+ names = backtrace_symbols (array, limit);
+ for (i = 1; i < limit; ++i) {
+ g_print ("\t%s\n", names [i]);
+ }
+ g_free (names);
+}
+
+#endif
+
/**
* mono_mempool_alloc:
* @pool: the momory pool to destroy
@@ -149,6 +170,12 @@
rval = pool->pos;
pool->pos = (guint8*)rval + size;
+#ifdef TRACE_ALLOCATIONS
+ if (pool == mono_get_corlib ()->mempool) {
+ g_print ("Allocating %d bytes\n", size);
+ mono_backtrace (7);
+ }
+#endif
if (G_UNLIKELY (pool->pos >= pool->end)) {
pool->pos -= size;
if (size >= 4096) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches