mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 11:37:35 +00:00
c4c812c154
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.
22 lines
542 B
C
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_ */
|