11 lines
247 B
C
11 lines
247 B
C
|
#include "libc/mem/mem.h"
|
||
|
#include "third_party/dlmalloc/dlmalloc.h"
|
||
|
|
||
|
size_t dlmalloc_usable_size(const void* mem) {
|
||
|
if (mem != 0) {
|
||
|
mchunkptr p = mem2chunk(mem);
|
||
|
if (is_inuse(p)) return chunksize(p) - overhead_for(p);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|