LeakFinder.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2019 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_LEAKFINDER_H
10 #define SQUID_LEAKFINDER_H
11 
12 #if USE_LEAKFINDER
13 
14 #include "hash.h"
15 
16 #define leakAdd(p,l) if (l) l->addSome(p,__FILE__,__LINE__)
17 #define leakTouch(p,l) if (l) l->touch(p,__FILE__,__LINE__)
18 #define leakFree(p,l) if (l) l->freeSome(p,__FILE__,__LINE__)
19 
20 class LeakFinderPtr : public hash_link
21 {
22 
23 public:
24  LeakFinderPtr(void *, const char *, const int);
25  const char *file;
26  int line;
27  time_t when;
28 };
29 
31 {
32 
33 public:
34  LeakFinder();
35  ~LeakFinder();
36 
37  void *addSome(void *, const char *, const int);
38 
39  void *touch(void *, const char *, const int);
40 
41  void *freeSome(void *, const char *, const int);
42 
43  void dump();
44 
45 private:
46  static HASHCMP cmp;
47 
48  static HASHHASH hash;
49 
51 
52  int count;
53 
54  time_t last_dump;
55 
56 };
57 
58 #else /* USE_LEAKFINDER */
59 
60 class LeakFinder {};
61 
62 #define leakAdd(p,l) (void)0
63 #define leakTouch(p,l) (void)0
64 #define leakFree(p,l) (void)0
65 #endif /* USE_LEAKFINDER */
66 
67 #endif /* SQUID_LEAKFINDER_H */
68 
hash_table * table
Definition: LeakFinder.h:50
unsigned int HASHHASH(const void *, unsigned int)
Definition: hash.h:14
LeakFinderPtr(void *, const char *, const int)
Definition: LeakFinder.cc:25
static HASHCMP cmp
Definition: LeakFinder.h:46
const char * file
Definition: LeakFinder.h:25
time_t when
Definition: LeakFinder.h:27
time_t last_dump
Definition: LeakFinder.h:54
static HASHHASH hash
Definition: LeakFinder.h:48
int HASHCMP(const void *, const void *)
Definition: hash.h:13

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors