ApplesauceOS
Read Markdown ↗Download .md

C.alloc

Allocate a zero-filled managed buffer.

js
client.alloc(bytes)

Arguments

ArgumentTypeMeaning
bytesnumberInteger 1..16777216; session total limit 64 MiB.

Returns

Managed pointer handle with byteLength/readBytes/writeBytes/release.

Example

js
const buffer = C.alloc(4);
try {
  buffer.writeBytes([65, 66, 67, 0]);
  console.log(buffer.readBytes());
} finally { buffer.release(); }

Notes

Use release(), not native free/realloc, for managed storage.

All JavaScript APIs · Automation playbook