FixNative Documentation

Back to summary

import "native/native";

Memory class

Pointer to memory region.

Inherits from Pointer.

Initialization

static function create(lo: Integer, hi: Integer, size: Integer, owned: Boolean): Memory
Creates a new memory region at given address and size. You can specify if it should automatically deallocate it using free function (when it's owned).

Allocation

static function alloc(size: Integer): Memory
Allocates a new memory region with given size. The memory is zeroed.
static function alloc_fast(size: Integer): Memory
Allocates a new memory region with given size. The memory is not zeroed.
function realloc(size: Integer): Memory
Rellocates the memory region with a new size. The old pointer must not be used.
function free()
Frees the memory region.

Properties

function get_size(): Integer
Returns the size of the memory region.
function is_owned(): Boolean
Returns whether the memory region is owned (will be automatically deallocated).

Utility functions

static function for_string_utf8(s: String): Memory
Returns a new memory region with given UTF-8 zero-terminated string.