generated from erix/meta
[FEATURE] Resize owned allocations within their original region #3
Labels
No labels
alpha-1
bug
ci
docs
duplicate
enhancement
help wanted
invalid
performance
phase-6
question
refactor
security
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
erix/lib-owned-region#3
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem and motivation
Growing a native tool buffer currently allocates its full replacement before returning the old block. That can fail when the original region has enough adjacent free bytes for the growth but cannot hold both complete buffers. Image assembly and whole-file inputs need useful growth within their explicitly supplied workspace.
Proposed behavior and scope
Add an original-pointer resize operation to ReservedHeap. Grow into an adjacent free extent, return a shrunken tail to the same free list, and preserve alignment and the retained payload prefix. RegionAllocator should use it for GlobalAlloc reallocation, then use the existing allocate/copy/return path when moving is necessary.
Authority, security and reliability
Every operation retains the same original writable region and its caller-owned backing lifetime. The live pointer and exact current Layout remain mandatory unsafe caller premises. Resizing acquires no memory, mapping, service or replacement arena. Check geometry before mutation; failed growth preserves the original allocation. Serialize the complete adapter operation under its existing guard, with no external or allocating callback. Allocation counts and complete-drain observations must remain accurate.
Acceptance criteria
Alternatives and tradeoffs
Keeping the default allocate/copy/return path is simple but requires a second full extent even for adjacent growth. Raising workspace budgets leaves that avoidable requirement in place. In-place growth remains conditional on actual contiguous free bytes; fragmentation can still require a move or an explicit allocation refusal. No measured runtime speedup is claimed.
Tracking and rollout
Build on the owned-region contract and shared library review. Coordinate native Boot and SHA consumers through their existing shared LibCli workspace. Keep Kernel backing acquisition and native grant retirement with their original owners.
Published
494312f3: allocations can grow into adjacent free space and return shrunken tails to their own region. The serialized adapter uses that path before allocating a replacement, preserving the live prefix and allocation count. Boot and SHA keep the shared adapter and their existing backing lifetimes.The library PR now includes resizing and the remaining consumer work.