Skip to main content
i++ inherits C’s pointer and stack behavior. The compiler also provides allocate for heap storage and free for manual deallocation.

Stack

Local variables follow C scope and lifetime rules.

Heap

Use allocate for dynamic storage and free when you are done.
autoremove and Robbery are not implemented. Every allocation made with allocate must be released explicitly with free.

Stack and heap

Ordinary local variables use the C stack model and have automatic scope lifetime. Use allocate when you need heap storage.

Allocate heap memory

Use brackets to allocate an array of elements:
Use parentheses for a single variable with a custom byte size:

Release allocations

Call free when the allocation is no longer needed:
Do not use a pointer after freeing it, and do not call free more than once for the same allocation.
1

Allocate

Choose an element-counted array or a custom byte size.
2

Use

Read and write the allocation while it is still valid.
3

Free

Release it exactly once with free.

Unsupported automatic ownership features

The language design includes autoremove for automatic deallocation and Robbery for ownership transfer. Neither feature is implemented in the current compiler. Use explicit free calls instead.