Allocator.free(arg) - chung-leong/zigar GitHub Wiki
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,
};
import { allocator, Point } from './allocator-js-example-2.zig';
const dv = allocator.alloc(4);
allocator.free(dv);
const point = new Point({ x: 1, y: 2 }, { allocator });
allocator.free(point);
Arguments:
arg
ADataView
returned byalloc()
or a Zig object created using the allocator.
Return value:
undefined