1 // Test for on-demand leak checking.
2 // RUN: %clangxx_lsan %s -o %t
3 // RUN: %env_lsan_opts=use_stacks=0:use_registers=0:symbolize=0 %run %t foo 2>&1 | FileCheck %s
4 // RUN: %env_lsan_opts=use_stacks=0:use_registers=0:symbolize=0 %run %t 2>&1 | FileCheck %s
12 #include <sanitizer/lsan_interface.h>
16 int main(int argc
, char *argv
[]) {
19 assert(__lsan_do_recoverable_leak_check() == 0);
21 fprintf(stderr
, "Test alloc: %p.\n", malloc(1337));
24 assert(__lsan_do_recoverable_leak_check() == 1);
25 // CHECK: SUMMARY: {{.*}}Sanitizer: 1337 byte
27 // Test that we correctly reset chunk tags.
29 assert(__lsan_do_recoverable_leak_check() == 1);
30 // CHECK: SUMMARY: {{.*}}Sanitizer: 1360 byte