You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 9, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 9, 2026. It is now read-only.
Once we have #3, we have a really nice characteristic:
Small allocations are always align(16). The extra bits can denote the small size bitshift... which incidentally is less than 16.
Large allocations are always align(32K) or align(64K). The extra bits can denote the total pages, which maps to 2GB or 4GB respectively.
With this type of packing, we only need a usize word (4B) for the metadata. Thus current minimum payload is expanded to 12B.
We might be able to support 4B payloads — it allows for align(8) which is not enough space to store the length, but we can possibly assume any align(8) has to be 4B allocations. Inconsistent metadata is very hard to detect so we'll stick with 12B minimum payloads.
I've been mixing up payload alignment and frame alignment. Consumers only care about payload alignment, but frame align = payload align - metasize
In order for allocations to be properly aligned, we have to stick with 4B or 8B payload. Therefore, it currently doesn't make any sense to pack the metadata.
However, converting to packed doubly-linked-list allows us to carve out space to squeeze in the length so it'd cost 0 bytes.
Less friendly debugging. Pointers in memory will no longer look like proper pointers.
Fewer redundancies. We have some rudimentary error checking to prevent memory corruption: pointer alignment and length, and neither will be usable going forward.
I think the tradeoffs are worth it. Long-term fragmentation is goal 3 and fast free() is goal 4, while debugging is not a real goal.
Activity
fengb commentedon Aug 7, 2019
I've been mixing up payload alignment and frame alignment. Consumers only care about payload alignment, but
frame align = payload align - metasizeIn order for allocations to be properly aligned, we have to stick with 4B or 8B payload. Therefore, it currently doesn't make any sense to pack the metadata.
However, converting to packed doubly-linked-list allows us to carve out space to squeeze in the length so it'd cost 0 bytes.
fengb commentedon Aug 8, 2019
There are some major disadvantages:
I think the tradeoffs are worth it. Long-term fragmentation is goal 3 and fast free() is goal 4, while debugging is not a real goal.
fengb commentedon Aug 8, 2019
This can be in tandem with converting to doubly-linked-list:
[-]Packed metadata[/-][+]Packed doubly-linked-list[/+]fengb commentedon Aug 10, 2019
This adds a depressing 1.5K (+60%) to release-fast and 4K (+100%) to release-safe. I can’t see this as being effective even with major hand tuning.