summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2023-03-16 09:41:11 +0300
committerIvan Maidanski <ivmai@mail.ru>2023-03-16 13:22:13 +0300
commit5871f287efc913063e9c42aef5962bebdc3f4692 (patch)
tree958106cfd10bc06fea9b3457573ab195b44b24e1
parenta58cb15d9ce31637f7ea76b726f02921ec03e0f8 (diff)
downloadbdwgc-5871f287efc913063e9c42aef5962bebdc3f4692.tar.gz
Define GC_print_stats as GC_INNER
(refactoring) * extra/MacOS.c [USE_TEMPORARY_MEMORY && !SHARED_LIBRARY_BUILD] (GC_MacFreeTemporaryMemory): Do not use GC_print_stats (assume it is always zero). * include/private/gc_priv.h [!NO_CLOCK || !SMALL_CONFIG] (GC_print_stats): Declared as GC_EXTERN; refine comment. * misc.c [!NO_CLOCK || !SMALL_CONFIG] (GC_print_stats): Define as GC_INNER. * tests/gctest.c [!GC_PRINT_VERBOSE_STATS && !GCTEST_PRINT_VERBOSE] (GC_print_stats): Update comment.
-rw-r--r--extra/MacOS.c9
-rw-r--r--include/private/gc_priv.h6
-rw-r--r--misc.c2
-rw-r--r--tests/gctest.c2
4 files changed, 5 insertions, 14 deletions
diff --git a/extra/MacOS.c b/extra/MacOS.c
index 082ee6ed..9bdaab9f 100644
--- a/extra/MacOS.c
+++ b/extra/MacOS.c
@@ -135,15 +135,6 @@ void GC_MacFreeTemporaryMemory(void)
tempMemBlock = nextBlock;
}
theTemporaryMemory = NULL;
-
-# if !defined(SHARED_LIBRARY_BUILD)
- if (GC_print_stats) {
- fprintf(stdout, "[total memory used: %ld bytes.]\n",
- totalMemoryUsed);
- fprintf(stdout, "[total collections: %lu]\n",
- (unsigned long)GC_gc_no);
- }
-# endif
}
}
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h
index 62fd71a8..ab61a614 100644
--- a/include/private/gc_priv.h
+++ b/include/private/gc_priv.h
@@ -2458,9 +2458,9 @@ GC_EXTERN void (*GC_print_heap_obj)(ptr_t p);
#define VERBOSE 2
#if !defined(NO_CLOCK) || !defined(SMALL_CONFIG)
- /* GC_print_stats should be visible to extra/MacOS.c. */
- extern int GC_print_stats; /* Nonzero generates basic GC log. */
- /* VERBOSE generates add'l messages. */
+ GC_EXTERN int GC_print_stats;
+ /* Value 1 generates basic GC log; */
+ /* VERBOSE generates additional messages. */
#else /* SMALL_CONFIG */
# define GC_print_stats 0
/* Will this remove the message character strings from the executable? */
diff --git a/misc.c b/misc.c
index 134fee1b..77ce78c3 100644
--- a/misc.c
+++ b/misc.c
@@ -94,7 +94,7 @@ int GC_dont_precollect = FALSE;
GC_bool GC_quiet = 0; /* used also in pcr_interface.c */
#if !defined(NO_CLOCK) || !defined(SMALL_CONFIG)
- int GC_print_stats = 0;
+ GC_INNER int GC_print_stats = 0;
#endif
#ifdef GC_PRINT_BACK_HEIGHT
diff --git a/tests/gctest.c b/tests/gctest.c
index 4e0d6622..75dda7de 100644
--- a/tests/gctest.c
+++ b/tests/gctest.c
@@ -71,7 +71,7 @@
# define print_stats VERBOSE
# define INIT_PRINT_STATS /* empty */
#else
- /* Use own variable as GC_print_stats might not be exported. */
+ /* Use own variable as GC_print_stats might not be visible. */
static int print_stats = 0;
# ifdef GC_READ_ENV_FILE
/* GETENV uses GC internal function in this case. */