core: span allocation with shared free list and geometric growth

Amp-Thread-ID: https://ampcode.com/threads/T-01a0b2dd-db32-712d-99ce-12ce4a86d979
Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
Amp
2026-09-18 05:26:26 +00:00
co-authored by heaust
parent e7546e4b78
commit dda602c4a2
7 changed files with 199 additions and 91 deletions
+3 -2
View File
@@ -97,9 +97,10 @@ export class YawnCore {
this.#arrays.delete(name);
}
async allocateObject(name) {
/** Reserves `count` contiguous rows and resolves with the first row ID. */
async allocateObject(name, count = 1) {
await this.ready;
const { id, rows } = await this.#request("allocate-object", { name });
const { id, rows } = await this.#request("allocate-object", { name, count });
this.#arrays.get(name).update(rows);
return id;
}