Age | Commit message (Collapse) | Author |
|
It can't be 100% precise but it doesn't really matter. Use this to implement
realloc() nicely. This also fixes a bug in realloc() where we didn't take
the size of the allocation metadata into account when computing the size of
an allocation backed by a BigAllocationBlock.
|
|
We were only reusing the existing allocation if the new requested size
was exactly the same as the fudged size of the block. This meant that
realloc() could allocate a new block even though the new block would be
identical to the old block.
|
|
This allows us to skip the separate call to set_mmap_name() in code that
we control, e.g malloc() and GraphicsBitmap.
|
|
|
|
This patch makes us recycle up to 8 blocks of 4KB size. This should
probably be extended to handle other sizes.
|
|
At the moment, both mmap() and munmap() are kind of slow. Compiling with GCC
was suffering quite badly from munmap() slowness, so let's keep a few more
of the ChunkedBlocks around after they are empty, to avoid having to munmap.
|
|
This way we only check actually usable blocks when trying to satisfy a new
allocation request.
|
|
This ensures that we continue allocating from partially-used blocks until
they are full.
|
|
Okay fine, I'll give them back. But we'll keep 4 blocks per size class on
hand, to reduce churn.
|
|
|
|
It's not thread-safe yet, and there is lots of room for improvement.
Still it's a lot faster than the first-fit bitmap-based one it replaces.
|