# define GC_OPT_INIT /* empty */
#endif
+#define INIT_FIND_LEAK \
+ if (!GC_get_find_leak()) {} else \
+ GC_printf("This test program is not designed for leak detection mode\n")
+
#define GC_COND_INIT() \
- INIT_FORK_SUPPORT; GC_OPT_INIT; CHECK_GCLIB_VERSION; INIT_PRINT_STATS
+ INIT_FORK_SUPPORT; GC_OPT_INIT; CHECK_GCLIB_VERSION; \
+ INIT_PRINT_STATS; INIT_FIND_LEAK
#define CHECK_OUT_OF_MEMORY(p) \
if ((p) == NULL) { \
FINALIZER_UNLOCK();
}
-# ifndef GC_NO_FINALIZATION
+# ifndef GC_NO_FINALIZATION
+ if (!GC_get_find_leak()) {
GC_REGISTER_FINALIZER((void *)result, finalizer, (void *)(GC_word)n,
(GC_finalization_proc *)0, (void * *)0);
if (my_index >= MAX_FINALIZED) {
FAIL;
}
# endif
-# endif
- GC_reachable_here(result);
+ }
+# endif
+ GC_reachable_here(result);
}
return(result);
}
int wstatus;
# endif
-# ifdef FIND_LEAK
- GC_printf(
- "This test program is not designed for leak detection mode\n");
- GC_printf("Expect lots of problems\n");
-# endif
GC_FREE(0);
# ifdef THREADS
if (!GC_thread_is_registered() && GC_is_init_called()) {
size_t max_heap_sz;
int i;
# ifndef GC_NO_FINALIZATION
- int still_live;
-# ifndef GC_LONG_REFS_NOT_NEEDED
- int still_long_live = 0;
-# endif
# ifdef FINALIZE_ON_DEMAND
int late_finalize_count = 0;
# endif
GC_printf("Allocated %d stubborn objects\n", stubborn_count);
GC_printf("Finalized %d/%d objects - ",
finalized_count, finalizable_count);
-# ifndef GC_NO_FINALIZATION
+# ifndef GC_NO_FINALIZATION
+ if (!GC_get_find_leak()) {
+ int still_live = 0;
+# ifndef GC_LONG_REFS_NOT_NEEDED
+ int still_long_live = 0;
+# endif
+
# ifdef FINALIZE_ON_DEMAND
if (finalized_count != late_finalize_count) {
GC_printf("Demand finalization error\n");
} else {
GC_printf("finalization is probably ok\n");
}
- still_live = 0;
for (i = 0; i < MAX_FINALIZED; i++) {
if (live_indicators[i] != 0) {
still_live++;
GC_printf("%d 'long' links remain\n", still_long_live);
}
# endif
-# endif
+ }
+# endif
GC_printf("Total number of bytes allocated is %lu\n",
(unsigned long)GC_get_total_bytes());
GC_printf("Final heap size is %lu bytes\n",
GC_printf("Incorrect execution - missed some allocations\n");
FAIL;
}
- if (GC_get_heap_size() + GC_get_unmapped_bytes() > max_heap_sz) {
+ if (GC_get_heap_size() + GC_get_unmapped_bytes() > max_heap_sz
+ && !GC_get_find_leak()) {
GC_printf("Unexpected heap growth - collector may be broken"
" (heapsize: %lu, expected: %lu)\n",
(unsigned long)(GC_get_heap_size() + GC_get_unmapped_bytes()),