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