Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Examples

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

A long-running service allocates short-lived request objects each iteration. Between iterations it calls gc_collect_if_needed from a host driver. Pacing prevents unbounded heap growth while keeping STW pauses short enough for cooperative fibers to meet latency goals.

Ten thousand Fiber<T> workers share one mutator. When a fiber blocks on channel_receive, the scheduler parks it and runs another fiber on the same mutator thread. GC can mark concurrently in the Abfall background thread, but no second fiber performs alloc on a different OS thread without violating GC-003.

let snap = beskid_runtime::runtime::snapshot_gc();
// Display bytes, object count, phase for diagnostics

Prefer this over reading gc_phase directly from generated tests in Rust harness code.

  1. Native code receives a Beskid string pointer.
  2. Host calls gc_register_root before storing the pointer in a global struct.
  3. After foreign use ends, gc_unregister_root releases the pin.

Skipping step 3 retains objects until explicit collection—often misreported as “memory leak” in bindings.

Lowering for record.child = value when value is a reference type:

  1. Store pointer field.
  2. gc_write_barrier(parent_obj, child_ref).

Omitting step 2 under concurrent marking can collect live objects.