Back to index

plt-scheme  4.2.1
leak_test.c
Go to the documentation of this file.
00001 #include "leak_detector.h"
00002 
00003 main() {
00004     int *p[10];
00005     int i;
00006     GC_find_leak = 1; /* for new collect versions not compiled  */
00007     /* with -DFIND_LEAK.                                        */
00008     for (i = 0; i < 10; ++i) {
00009         p[i] = malloc(sizeof(int)+i);
00010     }
00011     CHECK_LEAKS();
00012     for (i = 1; i < 10; ++i) {
00013         free(p[i]);
00014     }
00015     for (i = 0; i < 9; ++i) {
00016         p[i] = malloc(sizeof(int)+i);
00017     }
00018     CHECK_LEAKS();
00019     CHECK_LEAKS();
00020     CHECK_LEAKS();
00021 }