diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2022-05-03 21:29:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-03 21:29:09 +0300 |
commit | cbff54ac71f2a76d1f7e7c80d85328159857314a (patch) | |
tree | e539216da27956ad43684a8e700ed0621494eed4 /libnetdata/onewayalloc | |
parent | c53d2fc22538018f662494f9f08371d69c83bbab (diff) |
onewayallocator to use mallocz() instead of mmap() (#12810)
Diffstat (limited to 'libnetdata/onewayalloc')
-rw-r--r-- | libnetdata/onewayalloc/onewayalloc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libnetdata/onewayalloc/onewayalloc.c b/libnetdata/onewayalloc/onewayalloc.c index 3bc6e4bc7c..8c9ec76d26 100644 --- a/libnetdata/onewayalloc/onewayalloc.c +++ b/libnetdata/onewayalloc/onewayalloc.c @@ -50,8 +50,9 @@ static OWA_PAGE *onewayalloc_create_internal(OWA_PAGE *head, size_t size_hint) { // Make sure our allocations are always a multiple of the hardware page size if(size % OWA_NATURAL_PAGE_SIZE) size = size + OWA_NATURAL_PAGE_SIZE - (size % OWA_NATURAL_PAGE_SIZE); - OWA_PAGE *page = (OWA_PAGE *)netdata_mmap(NULL, size, MAP_ANONYMOUS|MAP_PRIVATE, 0); - if(unlikely(!page)) fatal("Cannot allocate onewayalloc buffer of size %zu", size); + // OWA_PAGE *page = (OWA_PAGE *)netdata_mmap(NULL, size, MAP_ANONYMOUS|MAP_PRIVATE, 0); + // if(unlikely(!page)) fatal("Cannot allocate onewayalloc buffer of size %zu", size); + OWA_PAGE *page = (OWA_PAGE *)mallocz(size); page->size = size; page->offset = natural_alignment(sizeof(OWA_PAGE)); @@ -168,6 +169,7 @@ void onewayalloc_destroy(ONEWAYALLOC *owa) { while(page) { OWA_PAGE *p = page; page = page->next; - munmap(p, p->size); + // munmap(p, p->size); + freez(p); } } |