mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-23 01:58:00 +02:00
Added TCMalloc and JEMalloc projects
This commit is contained in:
parent
53376f3861
commit
652142e189
242 changed files with 67746 additions and 6 deletions
41
BeefRT/JEMalloc/src/extent_mmap.c
Normal file
41
BeefRT/JEMalloc/src/extent_mmap.c
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include "jemalloc/internal/jemalloc_preamble.h"
|
||||
#include "jemalloc/internal/jemalloc_internal_includes.h"
|
||||
|
||||
#include "jemalloc/internal/assert.h"
|
||||
#include "jemalloc/internal/extent_mmap.h"
|
||||
|
||||
/******************************************************************************/
|
||||
/* Data. */
|
||||
|
||||
bool opt_retain =
|
||||
#ifdef JEMALLOC_RETAIN
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
void *
|
||||
extent_alloc_mmap(void *new_addr, size_t size, size_t alignment, bool *zero,
|
||||
bool *commit) {
|
||||
assert(alignment == ALIGNMENT_CEILING(alignment, PAGE));
|
||||
void *ret = pages_map(new_addr, size, alignment, commit);
|
||||
if (ret == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
assert(ret != NULL);
|
||||
if (*commit) {
|
||||
*zero = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
extent_dalloc_mmap(void *addr, size_t size) {
|
||||
if (!opt_retain) {
|
||||
pages_unmap(addr, size);
|
||||
}
|
||||
return opt_retain;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue