Add a batch allocation interface to the PAI.

For now, no real allocator actually implements this interface; this will change
in subsequent diffs.
This commit is contained in:
David Goldblatt 2021-01-07 12:27:43 -08:00 committed by David Goldblatt
parent bf448d7a5a
commit 480f3b11cd
6 changed files with 59 additions and 1 deletions

View file

@ -1,6 +1,19 @@
#include "jemalloc/internal/jemalloc_preamble.h"
#include "jemalloc/internal/jemalloc_internal_includes.h"
size_t
pai_alloc_batch_default(tsdn_t *tsdn, pai_t *self, size_t size,
size_t nallocs, edata_list_active_t *results) {
for (size_t i = 0; i < nallocs; i++) {
edata_t *edata = pai_alloc(tsdn, self, size, PAGE,
/* zero */ false);
if (edata == NULL) {
return i;
}
edata_list_active_append(results, edata);
}
return nallocs;
}
void
pai_dalloc_batch_default(tsdn_t *tsdn, pai_t *self,