Instruct the leak sanitizer to ignore leak warnings on the object referenced by the passed pointer, as well as all heap objects transitively referenced by it. The passed object pointer can point to either the beginning of the object or anywhere within it.
Declared in <absl/debugging/leak_check.h>
template<typename T>
T*
IgnoreLeak(T* ptr);
Example:
static T* obj = IgnoreLeak(new T(...));
If the passed ptr does not point to an actively allocated object at the time IgnoreLeak() is called, the call is a no-op; if it is actively allocated, leak sanitizer will assume this object is referenced even if there is no actual reference in user memory.
The same pointer that was passed in.
| Name | Description |
|---|---|
| ptr | Pointer to the object whose leaks should be ignored. |