source: box/trunk/lib/common/MemLeakFinder.h @ 2493

Revision 2493, 1.6 KB checked in by chris, 3 years ago (diff)

gcc 4.3 and 4.4 compile fixes, thanks to Reinhard Tartler and the Debian
project. See also:

 http://patch-tracking.debian.net/package/boxbackup/0.11~rc2+r2072-1
 http://lists.warhead.org.uk/pipermail/boxbackup/2009-April/005159.html

  • Property svn:eol-style set to native
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    MemLeakFinder.h
5//              Purpose: Memory leak finder
6//              Created: 12/1/04
7//
8// --------------------------------------------------------------------------
9
10#ifndef MEMLEAKFINDER__H
11#define MEMLEAKFINDER__H
12
13#ifdef MEMLEAKFINDER_FULL_MALLOC_MONITORING
14        // include stdlib now, to avoid problems with having the macros defined already
15        #include <cstdlib>
16#endif
17
18// global enable flag
19extern bool memleakfinder_global_enable;
20
21class MemLeakSuppressionGuard
22{
23        public:
24        MemLeakSuppressionGuard();
25        ~MemLeakSuppressionGuard();
26};
27
28extern "C"
29{
30        void *memleakfinder_malloc(size_t size, const char *file, int line);
31        void *memleakfinder_realloc(void *ptr, size_t size);
32        void memleakfinder_free(void *ptr);
33}
34
35void memleakfinder_init();
36
37int memleakfinder_numleaks();
38
39void memleakfinder_reportleaks();
40
41void memleakfinder_reportleaks_appendfile(const char *filename, const char *markertext);
42
43void memleakfinder_setup_exit_report(const char *filename, const char *markertext);
44
45void memleakfinder_startsectionmonitor();
46
47void memleakfinder_traceblocksinsection();
48
49void memleakfinder_notaleak(void *ptr);
50
51void *operator new  (size_t size, const char *file, int line);
52void *operator new[](size_t size, const char *file, int line);
53
54// define the malloc functions now, if required
55#ifdef MEMLEAKFINDER_FULL_MALLOC_MONITORING
56        #define malloc(X)       memleakfinder_malloc(X, __FILE__, __LINE__)
57        #define realloc         memleakfinder_realloc
58        #define free            memleakfinder_free
59        #define MEMLEAKFINDER_MALLOC_MONITORING_DEFINED
60#endif
61
62#endif // MEMLEAKFINDER__H
63
Note: See TracBrowser for help on using the repository browser.