]>
Commit | Line | Data |
---|---|---|
5113680f MW |
1 | /** |
2 | * @file leak_detective.h | |
3 | * | |
4 | * @brief malloc/free hooks to detect leaks. | |
5 | */ | |
6 | ||
7 | /* | |
8 | * Copyright (C) 2006 Martin Willi | |
9 | * Hochschule fuer Technik Rapperswil | |
10 | * | |
11 | * This program is free software; you can redistribute it and/or modify it | |
12 | * under the terms of the GNU General Public License as published by the | |
13 | * Free Software Foundation; either version 2 of the License, or (at your | |
14 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
15 | * | |
16 | * This program is distributed in the hope that it will be useful, but | |
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
18 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
19 | * for more details. | |
20 | */ | |
21 | ||
22 | #ifndef LEAK_DETECTIVE_H_ | |
23 | #define LEAK_DETECTIVE_H_ | |
24 | ||
25 | ||
26 | #ifdef LEAK_DETECTIVE | |
27 | ||
28 | /** | |
29 | * Max number of stack frames to include in a backtrace. | |
30 | */ | |
31 | #define STACK_FRAMES_COUNT 30 | |
32 | ||
6b3292da MW |
33 | /** |
34 | * Initialize leak detective, activates it | |
35 | */ | |
36 | void leak_detective_init(); | |
37 | ||
38 | /** | |
39 | * Cleanup leak detective, deactivates it | |
40 | */ | |
41 | void leak_detective_cleanup(); | |
5113680f | 42 | |
6b3292da | 43 | #else /* !LEAK_DETECTIVE */ |
5113680f | 44 | |
6b3292da MW |
45 | #define leak_detective_init() {} |
46 | #define leak_detective_cleanup() {} | |
5113680f MW |
47 | |
48 | #endif /* LEAK_DETECTIVE */ | |
49 | ||
50 | #endif /* LEAK_DETECTIVE_H_ */ |