Increasing threshold size for traversing memory blocks

L235 - Increased the memory threshold size so that we can further reduce fragmentation by allocating memory blocks that is close to the requested size by 16 bytes.
This commit is contained in:
Kevin Yonan 2019-07-21 17:35:54 -07:00 committed by GitHub
parent 4b2f6b2b5f
commit 973285ba61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -232,7 +232,7 @@ void *MemPoolAlloc(MemPool *const mempool, const size_t size)
if (mempool->freeList.head != NULL) if (mempool->freeList.head != NULL)
{ {
const size_t MEM_SPLIT_THRESHOLD = sizeof(intptr_t); const size_t MEM_SPLIT_THRESHOLD = 16;
// If the freelist is valid, let's allocate FROM the freelist then! // If the freelist is valid, let's allocate FROM the freelist then!
for (MemNode **inode = &mempool->freeList.head; *inode != NULL; inode = &(*inode)->next) for (MemNode **inode = &mempool->freeList.head; *inode != NULL; inode = &(*inode)->next)