summaryrefslogtreecommitdiff
path: root/alloc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-02-27 10:08:27 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-02-28 00:56:19 +0300
commit5b0ecdf4b614957676f40889ef88ce5a1f9f9fc7 (patch)
treec2ce209d481c0dacdd5e4b8590d76675d207b13b /alloc.c
parent338e1941b807b74de36b4ca335caffd72c5fbd11 (diff)
downloadbdwgc-5b0ecdf4b614957676f40889ef88ce5a1f9f9fc7.tar.gz
Adjust printing on amount of unmapped memory after GC
Previously, the amount of unmapped memory had been printed in GC cycle before the memory was unmapped (and the amount was recalculated) in that GC cycle. * alloc.c (GC_stopped_mark): Move assertions about GC_unmapped_bytes and GC_our_mem_bytes, and GC_DBGLOG_PRINTF() call to GC_finish_collection() (after GC_unmap_old call). * alloc.c [USE_MUNMAP] (GC_finish_collection): Call GC_unmap_old() right after GC_start_reclaim(FALSE); remove "Immediately reclaimed" verbose log message (because it duplicates the message passed to GC_DBGLOG_PRINTF).
Diffstat (limited to 'alloc.c')
-rw-r--r--alloc.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/alloc.c b/alloc.c
index 1d4fbcb5..cc563e52 100644
--- a/alloc.c
+++ b/alloc.c
@@ -903,18 +903,6 @@ STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func)
}
GC_gc_no++;
-# ifdef USE_MUNMAP
- GC_ASSERT(GC_heapsize >= GC_unmapped_bytes);
-# endif
- GC_ASSERT(GC_our_mem_bytes >= GC_heapsize);
- GC_DBGLOG_PRINTF("GC #%lu freed %ld bytes, heap %lu KiB ("
- IF_USE_MUNMAP("+ %lu KiB unmapped ")
- "+ %lu KiB internal)\n",
- (unsigned long)GC_gc_no, (long)GC_bytes_found,
- TO_KiB_UL(GC_heapsize - GC_unmapped_bytes) /*, */
- COMMA_IF_USE_MUNMAP(TO_KiB_UL(GC_unmapped_bytes)),
- TO_KiB_UL(GC_our_mem_bytes - GC_heapsize));
-
/* Check all debugged objects for consistency */
if (GC_debugging_started) {
(*GC_check_heap)();
@@ -1203,6 +1191,20 @@ STATIC void GC_finish_collection(void)
/* Reconstruct free lists to contain everything not marked */
GC_start_reclaim(FALSE);
+
+# ifdef USE_MUNMAP
+ GC_unmap_old();
+
+ GC_ASSERT(GC_heapsize >= GC_unmapped_bytes);
+# endif
+ GC_ASSERT(GC_our_mem_bytes >= GC_heapsize);
+ GC_DBGLOG_PRINTF("GC #%lu freed %ld bytes, heap %lu KiB ("
+ IF_USE_MUNMAP("+ %lu KiB unmapped ")
+ "+ %lu KiB internal)\n",
+ (unsigned long)GC_gc_no, (long)GC_bytes_found,
+ TO_KiB_UL(GC_heapsize - GC_unmapped_bytes) /*, */
+ COMMA_IF_USE_MUNMAP(TO_KiB_UL(GC_unmapped_bytes)),
+ TO_KiB_UL(GC_our_mem_bytes - GC_heapsize));
GC_DBGLOG_PRINTF("In-use heap: %d%% (%lu KiB pointers + %lu KiB other)\n",
GC_compute_heap_usage_percent(),
TO_KiB_UL(GC_composite_in_use),
@@ -1215,13 +1217,6 @@ STATIC void GC_finish_collection(void)
> min_bytes_allocd();
}
- GC_VERBOSE_LOG_PRINTF("Immediately reclaimed %ld bytes, heapsize:"
- " %lu bytes" IF_USE_MUNMAP(" (%lu unmapped)") "\n",
- (long)GC_bytes_found,
- (unsigned long)GC_heapsize /*, */
- COMMA_IF_USE_MUNMAP((unsigned long)
- GC_unmapped_bytes));
-
/* Reset or increment counters for next cycle */
GC_n_attempts = 0;
GC_is_full_gc = FALSE;
@@ -1232,8 +1227,6 @@ STATIC void GC_finish_collection(void)
GC_bytes_freed = 0;
GC_finalizer_bytes_freed = 0;
- IF_USE_MUNMAP(GC_unmap_old());
-
if (GC_on_collection_event)
GC_on_collection_event(GC_EVENT_RECLAIM_END);
# ifndef NO_CLOCK