|
Last change
on this file was 132, checked in by cinc, 19 years ago |
|
Boehm-Demers-Weiser garbage collector. Single-threaded for OS/2.
|
|
File size:
489 bytes
|
| Line | |
|---|
| 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 | for (i = 0; i < 10; ++i) {
|
|---|
| 9 | p[i] = malloc(sizeof(int)+i);
|
|---|
| 10 | }
|
|---|
| 11 | CHECK_LEAKS();
|
|---|
| 12 | for (i = 1; i < 10; ++i) {
|
|---|
| 13 | free(p[i]);
|
|---|
| 14 | }
|
|---|
| 15 | for (i = 0; i < 9; ++i) {
|
|---|
| 16 | p[i] = malloc(sizeof(int)+i);
|
|---|
| 17 | }
|
|---|
| 18 | CHECK_LEAKS();
|
|---|
| 19 | CHECK_LEAKS();
|
|---|
| 20 | CHECK_LEAKS();
|
|---|
| 21 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.