I'm playing around with raylib and trying to use a gpa causes a segfault when calling in to the lib, but using a page_allocator seems to work fine. Anyone have any ideas, what am I missing? Docs say to use .init instead of default struct init, but I'm not sure how to. Using the gpa in this manner elsewhere works as expected.
zig version 14.something, raylib 5.5
const std = @import("std");
const rl = @cImport({
@cInclude("raylib.h");
});
pub fn main() !void {
rl.InitWindow(1920, 1080, "test");
rl.SetTargetFPS(60);
// this causes segfault in rl.DrawText()
// var gpa = std.heap.GeneralPurposeAllocator(.{}){};
// defer _ = gpa.deinit();
// const allocator = gpa.allocator();
// this works fine
const allocator = std.heap.page_allocator;
while (!rl.WindowShouldClose()) {
rl.BeginDrawing();
rl.ClearBackground(rl.DARKGRAY);
const fps = try std.fmt.allocPrint(allocator, "{d}", .{rl.GetFPS()});
rl.DrawText(fps.ptr, 10, 10, 20, rl.LIGHTGRAY);
rl.EndDrawing();
}
rl.CloseWindow();
}