summaryrefslogtreecommitdiff
path: root/reclaim.c
diff options
context:
space:
mode:
authorivmai <ivmai>2011-05-06 06:43:49 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:58 +0200
commit9d99463219d3125e87c7a07cf6aba5624e16aae6 (patch)
tree5202a4816a9a04ac8fa7b8ed64dbebf238b90cfa /reclaim.c
parentb898fa85675826496de2c476276ff8ca4af756bf (diff)
2011-05-06 Ivan Maidanski <ivmai@mail.ru>
* dbg_mlc.c (GC_has_other_debug_info): Change return type to int; return -1 if the object has (or had) debugging info but was marked deallocated. * include/private/dbg_mlc.h (GC_has_other_debug_info): Ditto. * dbg_mlc.c (GC_has_other_debug_info): Update documentation; remove "ohdr" local variable. * dbg_mlc.c (GC_debug_free): Don't call GC_free if the object has probably been deallocated. * dbg_mlc.c (GC_debug_free): Don't actually free the object even in the leak-finding mode if GC_findleak_delay_free. * dbg_mlc.c (GC_print_all_smashed_proc): Print a trailing blank line. * dbg_mlc.c (GC_check_leaked): New function (only unless SHORT_DBG_HDRS). * doc/README.environment (GC_FINDLEAK_DELAY_FREE): Document. * doc/README.macros (GC_FINDLEAK_DELAY_FREE): Ditto. * include/private/dbg_mlc.h (START_FLAG, END_FLAG): Use GC_WORD_C on 64-bit architectures. * include/private/dbg_mlc.h (NOT_MARKED): Remove redundant parentheses. * include/private/dbg_mlc.h (GC_HAS_DEBUG_INFO): Update (due to GC_has_other_debug_info change). * include/private/gc_priv.h (GC_findleak_delay_free): New global variable declaration (unless SHORT_DBG_HDRS). * misc.c (GC_findleak_delay_free): New global variable; recognize GC_FINDLEAK_DELAY_FREE. * misc.c (GC_init): Recognize GC_FINDLEAK_DELAY_FREE environment variable (unless SHORT_DBG_HDRS). * reclaim.c (GC_check_leaked): Declare (unless SHORT_DBG_HDRS). * reclaim.c (GC_add_leaked): Don't add the object to leaked list if marked as deallocated.
Diffstat (limited to 'reclaim.c')
-rw-r--r--reclaim.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/reclaim.c b/reclaim.c
index f9bfd85..c9e8e53 100644
--- a/reclaim.c
+++ b/reclaim.c
@@ -41,8 +41,17 @@ STATIC unsigned GC_n_leaked = 0;
GC_INNER GC_bool GC_have_errors = FALSE;
+#ifndef SHORT_DBG_HDRS
+ GC_INNER GC_bool GC_check_leaked(ptr_t base); /* from dbg_mlc.c */
+#endif
+
GC_INLINE void GC_add_leaked(ptr_t leaked)
{
+# ifndef SHORT_DBG_HDRS
+ if (GC_findleak_delay_free && !GC_check_leaked(leaked))
+ return;
+# endif
+
GC_have_errors = TRUE;
/* FIXME: Prevent adding an object while printing leaked ones. */
if (GC_n_leaked < MAX_LEAKED) {