You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rtpengine/daemon/memory_arena.c

14 lines
316 B

#include "memory_arena.h"
#include <sys/mman.h>
__thread memory_arena_t *memory_arena;
void *memory_arena_malloc(size_t size) {
return mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
}
void memory_arena_free(void *p) {
size_t *s = p; // first element is the size
munmap(p, *s);
}