Suppose we execute a malloc request for a memory block of size n, where 2 ^ k! = N for k> 0. Malloc returns us the space for this requested memory block, but as the remainder buffer is processed from the page. I read "Pages", as a rule, are blocks of memory that are powers of two.
The wiki states the following:
Like any method of memory allocation, the heap will become fragmented; that is, there will be sections of used and unused memory in the allocated space on the heap. A good allocator will attempt to find an unused area of already allocated memory to use before resorting to expanding the heap.
So my question is how is this tracked?
EDIT: how is unused memory tracked when using malloc?
c linux malloc
Praveen s
source share