]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #include "leak_detector.h" |
2 | ||
3 | main() { | |
4 | int *p[10]; | |
5 | int i; | |
6 | GC_find_leak = 1; /* for new collect versions not compiled */ | |
7 | /* with -DFIND_LEAK. */ | |
8 | ||
9 | GC_INIT(); /* Needed if thread-local allocation is enabled. */ | |
10 | /* FIXME: This is not ideal. */ | |
11 | for (i = 0; i < 10; ++i) { | |
12 | p[i] = malloc(sizeof(int)+i); | |
13 | } | |
14 | CHECK_LEAKS(); | |
15 | for (i = 1; i < 10; ++i) { | |
16 | free(p[i]); | |
17 | } | |
18 | for (i = 0; i < 9; ++i) { | |
19 | p[i] = malloc(sizeof(int)+i); | |
20 | } | |
21 | CHECK_LEAKS(); | |
22 | CHECK_LEAKS(); | |
23 | CHECK_LEAKS(); | |
24 | return 0; | |
25 | } |