← Back to context

Comment by dnautics

6 hours ago

> However, there's no global allocator in zig. You simply cannot call the language's equivalent of malloc() because it doesn't exist - at least not as a global symbol.

I mean std.heap.page_allocator is global, and there's only the one, and you can call it from wherever (just as you can malloc). Same with std.heap. c_allocator, which is... malloc! you can also create your own global allocator.

Don't do this in libraries ofc or the ghost of Andrew Kelly will haunt you in hour sleep.