summaryrefslogtreecommitdiff
path: root/reclaim.c
diff options
context:
space:
mode:
authorivmai <ivmai>2011-04-07 22:35:46 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:57 +0200
commitbe457cfd5dde0cc1a1db497a70c15b7bd38153b8 (patch)
tree3a5446226dc138c7113e857a219cd971fc24cea0 /reclaim.c
parent1348d9d446428a3afc8900881b61ed7bbdffe5f5 (diff)
2011-04-07 Ivan Maidanski <ivmai@mail.ru>
* alloc.c (GC_check_heap, GC_print_all_smashed): Move the definition from misc.c. * dbg_mlc.c (GC_debug_malloc_atomic_uncollectable): Define as public. * include/gc.h (GC_debug_malloc_atomic_uncollectable): Declare. * include/gc.h (GC_MALLOC_ATOMIC_UNCOLLECTABLE): Define new public macro. * dbg_mlc.c (MAX_SMASHED): Don't define if already set. * reclaim.c (MAX_LEAKED): Ditto. * dbg_mlc.c (GC_add_smashed): Add FIXME about the concurrent access to the global array. * reclaim.c (GC_add_leaked): Ditto. * misc.c (GC_print_back_height): Set on if GC_PRINT_BACK_HEIGHT (new macro) is defined. * doc/README.macros (GC_PRINT_BACK_HEIGHT): Document. * misc.c (GC_dump_regularly, GC_init): Replace 0/1 for GC_dump_regularly and GC_print_back_height variables with FALSE/TRUE. * reclaim.c (GC_print_all_errors): Refine the comment.
Diffstat (limited to 'reclaim.c')
-rw-r--r--reclaim.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/reclaim.c b/reclaim.c
index a0f6dd3..e17d374 100644
--- a/reclaim.c
+++ b/reclaim.c
@@ -33,7 +33,9 @@ GC_INNER signed_word GC_bytes_found = 0;
/* We defer printing of leaked objects until we're done with the GC */
/* cycle, since the routine for printing objects needs to run outside */
/* the collector, e.g. without the allocation lock. */
-#define MAX_LEAKED 40
+#ifndef MAX_LEAKED
+# define MAX_LEAKED 40
+#endif
STATIC ptr_t GC_leaked[MAX_LEAKED] = { NULL };
STATIC unsigned GC_n_leaked = 0;
@@ -41,16 +43,17 @@ GC_INNER GC_bool GC_have_errors = FALSE;
STATIC void GC_add_leaked(ptr_t leaked)
{
+ GC_have_errors = TRUE;
+ /* FIXME: Prevent adding an object while printing leaked ones. */
if (GC_n_leaked < MAX_LEAKED) {
- GC_have_errors = TRUE;
GC_leaked[GC_n_leaked++] = leaked;
/* Make sure it's not reclaimed this cycle */
- GC_set_mark_bit(leaked);
+ GC_set_mark_bit(leaked);
}
}
/* Print all objects on the list after printing any smashed objects. */
-/* Clear both lists. */
+/* Clear both lists. Called without the allocation lock held. */
GC_INNER void GC_print_all_errors(void)
{
static GC_bool printing_errors = FALSE;