]> git.ipfire.org Git - thirdparty/squid.git/blame - src/LeakFinder.h
Prep for 3.3.12 and 3.4.4
[thirdparty/squid.git] / src / LeakFinder.h
CommitLineData
82f27590 1#ifndef SQUID_LEAKFINDER_H
2#define SQUID_LEAKFINDER_H
3
4#if USE_LEAKFINDER
c38a2377
AJ
5
6#include "hash.h"
7
8#define leakAdd(p,l) if (l) l->addSome(p,__FILE__,__LINE__)
82f27590 9#define leakTouch(p,l) if (l) l->touch(p,__FILE__,__LINE__)
c38a2377 10#define leakFree(p,l) if (l) l->freeSome(p,__FILE__,__LINE__)
82f27590 11
12class LeakFinderPtr : public hash_link
13{
14
15public:
16 LeakFinderPtr(void *, const char *, const int);
17 const char *file;
18 int line;
19 time_t when;
20};
21
22class LeakFinder
23{
24
25public:
26 LeakFinder();
27 ~LeakFinder();
28
c38a2377 29 void *addSome(void *, const char *, const int);
82f27590 30
31 void *touch(void *, const char *, const int);
32
c38a2377 33 void *freeSome(void *, const char *, const int);
82f27590 34
35 void dump();
36
37private:
38 static HASHCMP cmp;
39
40 static HASHHASH hash;
41
42 hash_table *table;
43
44 int count;
45
46 time_t last_dump;
47
48};
49
50#else /* USE_LEAKFINDER */
51
52class LeakFinder {};
53
54#define leakAdd(p,l) (void)0
55#define leakTouch(p,l) (void)0
56#define leakFree(p,l) (void)0
57#endif /* USE_LEAKFINDER */
58
59#endif /* SQUID_LEAKFINDER_H */