2 * Copyright (c) 2000-2011 by Hewlett-Packard Development Company.
5 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
6 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
8 * Permission is hereby granted to use or copy this program
9 * for any purpose, provided the above notices are retained on all copies.
10 * Permission to modify the code and to distribute modified code is granted,
11 * provided the above notices are retained, and a notice that the code was
12 * modified is included with the above copyright notice.
15 #ifndef GC_LEAK_DETECTOR_H
16 #define GC_LEAK_DETECTOR_H
18 /* Include leak_detector.h (eg., via GCC --include directive) */
19 /* to turn BoehmGC into a Leak Detector. */
26 #ifndef GC_DONT_INCLUDE_STDLIB
27 /* We ensure stdlib.h and string.h are included before */
28 /* redirecting malloc() and the accompanying functions. */
34 #define malloc(n) GC_MALLOC(n)
36 #define calloc(m,n) GC_MALLOC((m)*(n))
38 #define free(p) GC_FREE(p)
40 #define realloc(p,n) GC_REALLOC(p,n)
43 #define strdup(s) GC_STRDUP(s)
45 #define strndup(s,n) GC_STRNDUP(s,n)
47 #ifdef GC_REQUIRE_WCSDUP
48 /* The collector should be built with GC_REQUIRE_WCSDUP */
49 /* defined as well to redirect wcsdup(). */
52 # define wcsdup(s) GC_WCSDUP(s)
56 #define memalign(a,n) GC_memalign(a,n)
58 #define posix_memalign(p,a,n) GC_posix_memalign(p,a,n)
61 # define CHECK_LEAKS() GC_gcollect()
62 /* Note 1: CHECK_LEAKS does not have GC prefix (preserved for */
63 /* backward compatibility). */
64 /* Note 2: GC_gcollect() is also called automatically in the */
65 /* leak-finding mode at program exit. */
68 #endif /* GC_LEAK_DETECTOR_H */