Add leak sanitize annotations
Summary: Add a function `folly::annotate_object_leaked(void const*)` that suppresses LSAN warnings for the passed pointer. It does so by keeping a static map of all the pointers passed to the function. Objects can later be unsuppressed with `annotate_object_collected(void const*)`. When ASAN is disabled the function is an inlinable no-op. This function is useful when you want to intentionally leak memory, and LSAN isn't smart enough to detect the pointer stored in memory. For example at the time of writing LSAN cannot follow the pointer in `folly::atomic_shared_ptr`. Reviewed By: yfeldblum Differential Revision: D15755788 fbshipit-source-id: d9be0cfb253f1b89d691892eb085c0b2349c4438
Showing
folly/memory/SanitizeLeak.h
0 → 100644
Please register or sign in to comment