GHC.Base.breakpoint isn't vaporware anymore.
[ghc-hetmet.git] / ghc / rts / RtsStartup.c
index faf4596..147de7b 100644 (file)
@@ -313,7 +313,8 @@ void
 hs_exit(void)
 {
     if (hs_init_count <= 0) {
-       barf("too many hs_exit()s");
+       errorBelch("warning: too many hs_exit()s");
+       return;
     }
     hs_init_count--;
     if (hs_init_count > 0) {
@@ -373,9 +374,8 @@ hs_exit(void)
     /* stop timing the shutdown, we're about to print stats */
     stat_endExit();
     
-    /* clean up things from the storage manager's point of view.
-     * also outputs the stats (+RTS -s) info.
-     */
+    // clean up things from the storage manager's point of view.
+    // also outputs the stats (+RTS -s) info.
     exitStorage();
     
 #ifdef RTS_GTK_FRONTPANEL
@@ -398,7 +398,7 @@ hs_exit(void)
     // during endProfiling().
     fclose(prof_file);
 #endif
-    
+
 #if defined(TICKY_TICKY)
     if (RtsFlags.TickyFlags.showTickyStats) PrintTickyInfo();
 #endif
@@ -406,6 +406,9 @@ hs_exit(void)
 #if defined(mingw32_HOST_OS)
     shutdownAsyncIO();
 #endif
+
+    // Finally, free all our storage.
+    freeStorage();
 }
 
 // Compatibility interfaces