[FEATURE] Share allocation within caller-owned memory regions #1

Open
opened 2026-10-17 09:22:02 +02:00 by erikinkinen · 0 comments
Owner

Problem and motivation

Kernel's region allocator should be reusable by native tools without copying
its implementation or adding implicit memory acquisition.

Proposed behavior and scope

Share the existing free-list algorithm and add a serialized GlobalAlloc
adapter. Each caller supplies one writable region and keeps its original owner.
Migrate Kernel to the shared primitive without changing its reserved-heap policy.

Authority, security and reliability

Installation is explicit and one-shot. Allocation cannot discover services,
acquire backing, grow the region or select a fallback. Unsafe callers preserve
exclusive access, mapping lifetime and exact pointer/layout pairs. Local drain
observations do not retire native mappings or grants; uncertain cleanup keeps
those owners alive. Allocation failure records scalar state without allocating.

Acceptance criteria

  • Publish the shared primitive and serialized adapter with useful rustdoc.
  • Cover geometry, exhaustion, exact reuse, failure and concurrent allocation.
  • Pass strict default/release Cargo checks and freestanding library builds.
  • Register governance, source catalogs, CI and manual documentation.
  • Replace Kernel's duplicate primitive and preserve its native probe.

Alternatives and tradeoffs

Keeping separate copies makes fixes diverge. A growing heap would require a
separate memory-acquisition policy; it is outside this library's boundary.
The serialization guard excludes reentry and promises no scheduler fairness.

Tracking and rollout

Supports native build tools
and phase completion.
Register the actual template seed, publish the library with a registered CI
helper, then migrate Kernel and refresh the final dependency snapshots.
Native startup and authenticated tool bindings remain separate work.

Review: shared allocation implementation.

## Problem and motivation Kernel's region allocator should be reusable by native tools without copying its implementation or adding implicit memory acquisition. ## Proposed behavior and scope Share the existing free-list algorithm and add a serialized `GlobalAlloc` adapter. Each caller supplies one writable region and keeps its original owner. Migrate Kernel to the shared primitive without changing its reserved-heap policy. ## Authority, security and reliability Installation is explicit and one-shot. Allocation cannot discover services, acquire backing, grow the region or select a fallback. Unsafe callers preserve exclusive access, mapping lifetime and exact pointer/layout pairs. Local drain observations do not retire native mappings or grants; uncertain cleanup keeps those owners alive. Allocation failure records scalar state without allocating. ## Acceptance criteria - [x] Publish the shared primitive and serialized adapter with useful rustdoc. - [x] Cover geometry, exhaustion, exact reuse, failure and concurrent allocation. - [x] Pass strict default/release Cargo checks and freestanding library builds. - [ ] Register governance, source catalogs, CI and manual documentation. - [ ] Replace Kernel's duplicate primitive and preserve its native probe. ## Alternatives and tradeoffs Keeping separate copies makes fixes diverge. A growing heap would require a separate memory-acquisition policy; it is outside this library's boundary. The serialization guard excludes reentry and promises no scheduler fairness. ## Tracking and rollout Supports [native build tools](https://git.erikinkinen.fi/erix/integration/issues/8) and [phase completion](https://git.erikinkinen.fi/erix/integration/issues/65). Register the actual template seed, publish the library with a registered CI helper, then migrate Kernel and refresh the final dependency snapshots. Native startup and authenticated tool bindings remain separate work. Review: [shared allocation implementation](https://git.erikinkinen.fi/erix/lib-owned-region/pulls/2).
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:34:48 +01:00
Sign in to join this conversation.
No description provided.