summaryrefslogtreecommitdiff
path: root/rts/RtsStartup.c
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2006-12-11 12:49:50 +0000
committerIan Lynagh <igloo@earth.li>2006-12-11 12:49:50 +0000
commitd526504719676871376324858fe2073aa2011424 (patch)
treea879addf6cf10eb1f4e4c55902ea9e4b673e8cac /rts/RtsStartup.c
parent2423c249f5ca7785d0ec89eb33e72662da7561c1 (diff)
downloadhaskell-d526504719676871376324858fe2073aa2011424.tar.gz
When debugging, have the allocator help us a bit
We now check for freeing memory that isn't allocated, and overwrite memory we are about to free with 0xaa. It might be nice to also have a flag to control whether the memory actually gets free'd.
Diffstat (limited to 'rts/RtsStartup.c')
-rw-r--r--rts/RtsStartup.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 824ef98101..5bb980674d 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -138,7 +138,13 @@ hs_init(int *argc, char **argv[])
return;
}
- /* The very first thing we do is grab the start time...just in case we're
+#if defined(DEBUG)
+ /* Start off by initialising the allocator debugging so we can
+ * use it anywhere */
+ initAllocator();
+#endif
+
+ /* Next we do is grab the start time...just in case we're
* collecting timing statistics.
*/
stat_startInit();
@@ -470,8 +476,14 @@ hs_exit(void)
shutdownAsyncIO();
#endif
- // Finally, free all our storage.
+ // Finally, free all our storage
freeStorage();
+
+#if defined(DEBUG)
+ /* and shut down the allocator debugging */
+ shutdownAllocator();
+#endif
+
}
// Compatibility interfaces