]> granicus.if.org Git - gc/commitdiff
Log amount of unmapped memory (if enabled) on marking-for-collection
authorIvan Maidanski <ivmai@mail.ru>
Fri, 27 Jan 2012 15:07:20 +0000 (19:07 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 27 Jan 2012 15:07:20 +0000 (19:07 +0400)
* alloc.c (GC_stopped_mark, GC_print_heap_sects): Print
GC_unmapped_bytes value to log if USE_MUNMAP.

alloc.c

diff --git a/alloc.c b/alloc.c
index 9b2a7e22e24aa3ff708bae7e2e1c3ab733460f31..360463af487e77c2629716166ebac76d08ea94d5 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -644,16 +644,17 @@ STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func)
 
     GC_gc_no++;
     if (GC_print_stats) {
-      GC_log_printf(
-             "Collection %lu reclaimed %ld bytes ---> heapsize = %lu bytes\n",
-             (unsigned long)(GC_gc_no - 1), (long)GC_bytes_found,
-             (unsigned long)GC_heapsize);
+      GC_log_printf("Collection %lu reclaimed %ld bytes ---> heapsize = %lu"
+                    " bytes" IF_USE_MUNMAP(" (%lu unmapped)") "\n",
+                    (unsigned long)(GC_gc_no - 1), (long)GC_bytes_found,
+                    (unsigned long)GC_heapsize /*, */
+                    COMMA_IF_USE_MUNMAP((unsigned long)GC_unmapped_bytes));
     }
 
     /* Check all debugged objects for consistency */
-        if (GC_debugging_started) {
-            (*GC_check_heap)();
-        }
+    if (GC_debugging_started) {
+      (*GC_check_heap)();
+    }
 
 #   ifdef THREAD_LOCAL_ALLOC
       GC_world_stopped = FALSE;
@@ -1063,7 +1064,10 @@ GC_INNER void GC_add_to_heap(struct hblk *p, size_t bytes)
   {
     unsigned i;
 
-    GC_printf("Total heap size: %lu\n", (unsigned long)GC_heapsize);
+    GC_printf("Total heap size: %lu" IF_USE_MUNMAP(" (%lu unmapped)") "\n",
+              (unsigned long)GC_heapsize /*, */
+              COMMA_IF_USE_MUNMAP((unsigned long)GC_unmapped_bytes));
+
     for (i = 0; i < GC_n_heap_sects; i++) {
       ptr_t start = GC_heap_sects[i].hs_start;
       size_t len = GC_heap_sects[i].hs_bytes;