cosmopolitan/libc/mem/leaks.h
Justine Tunney c4c812c154
Introduce ctl::set and ctl::map
We now have a C++ red-black tree implementation that implements standard
template library compatible APIs while compiling 10x faster than libcxx.
It's not as beautiful as the red-black tree implementation in Plinko but
this will get the job done and the test proves it upholds all invariants

This change also restores CheckForMemoryLeaks() support and fixes a real
actual bug I discovered with Doug Lea's dlmalloc_inspect_all() function.
2024-06-23 22:27:11 -07:00

22 lines
542 B
C

#ifndef COSMOPOLITAN_LIBC_MEM_LEAKS_H_
#define COSMOPOLITAN_LIBC_MEM_LEAKS_H_
#include "libc/intrin/weaken.h"
COSMOPOLITAN_C_START_
void CheckForMemoryLeaks(void) libcesque;
/**
* Declares that allocation needn't be freed.
*
* This function does nothing if CheckForMemoryLeaks() hasn't been
* linked into the binary.
*/
forceinline void *may_leak(void *__p) {
void __may_leak(void *) libcesque;
if (_weaken(__may_leak))
_weaken(__may_leak)(__p);
return __p;
}
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_MEM_LEAKS_H_ */