mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 11:37:35 +00:00
10 lines
247 B
C
10 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;
|
|
}
|