| 1 | // This program is supposed to test the leak detector which |
| 2 | // is integrated with `-gc boehm_leak` at compile time. |
| 3 | // |
| 4 | // If compiled with `-gc boehm` or without `-gc` nothing |
| 5 | // will be reported. |
| 6 | |
| 7 | fn main() { |
| 8 | mut y := unsafe { malloc(1000) } |
| 9 | // unsafe { free(y) } // leak if commented out |
| 10 | y = unsafe { nil } |
| 11 | _ = y |
| 12 | gc_check_leaks() |
| 13 | } |
| 14 |