// RUN: %clangxx_asan -O2 %s -o %t && %run %t #include #include #include #include #include std::atomic done; void foo() { std::unique_ptr mem; while (!done) mem.reset(new char[1000000]); } int main() { std::vector threads; for (int i = 0; i < 10; ++i) threads.emplace_back(foo); for (int i = 0; i < 100; ++i) __lsan_do_recoverable_leak_check(); done = true; for (auto &t : threads) t.join(); return 0; }