Allocator.free(arg) ᴾᴴᴾ - chung-leong/zigar GitHub Wiki
JavaScript | PHP
Free previous allocated memory.
Usage
const std = @import("std");
var gpa = std.heap.DebugAllocator(.{}).init;
pub const allocator = gpa.allocator();
pub const Point = struct {
x: i32,
y: i32,
};
<?php
$m = zigar_use(__DIR__ . '/allocator-js-example-2.zig');
$buf = $m->allocator->alloc(4);
$m->allocator->free($buf);
$point = new $m->Point(x: 1, y: 2, allocator: $m->allocator);
$m->allocator->free($point);
Arguments:
arg
AnArrayBufferor typed array returned byalloc()or a Zig object created using the allocator.
Return value:
null