mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
use the c allocator when running under valgrind
This commit is contained in:
@ -194,12 +194,14 @@ pub fn create(alloc: Allocator, loop: libuv.Loop, config: *const Config) !*Windo
|
||||
gl.glad.versionMajor(version),
|
||||
gl.glad.versionMinor(version),
|
||||
});
|
||||
if (builtin.mode == .Debug) {
|
||||
var ext_iter = try gl.ext.iterator();
|
||||
while (try ext_iter.next()) |ext| {
|
||||
log.debug("OpenGL extension available name={s}", .{ext});
|
||||
}
|
||||
}
|
||||
// These are very noisy so this is commented, but easy to uncomment
|
||||
// whenever we need to check the OpenGL extension list
|
||||
// if (builtin.mode == .Debug) {
|
||||
// var ext_iter = try gl.ext.iterator();
|
||||
// while (try ext_iter.next()) |ext| {
|
||||
// log.debug("OpenGL extension available name={s}", .{ext});
|
||||
// }
|
||||
// }
|
||||
|
||||
if (builtin.mode == .Debug) {
|
||||
// Get our physical DPI - debug only because we don't have a use for
|
||||
|
11
src/main.zig
11
src/main.zig
@ -25,10 +25,13 @@ pub fn main() !void {
|
||||
// faster than GPA. We only do this in release modes so that we
|
||||
// can get easy memory leak detection in debug modes.
|
||||
if (builtin.link_libc) {
|
||||
switch (builtin.mode) {
|
||||
.ReleaseSafe, .ReleaseFast => break :gpa std.heap.c_allocator,
|
||||
else => {},
|
||||
}
|
||||
if (switch (builtin.mode) {
|
||||
.ReleaseSafe, .ReleaseFast => true,
|
||||
|
||||
// We also use it if we can detect we're running under
|
||||
// Valgrind since Valgrind only instruments the C allocator
|
||||
else => std.valgrind.runningOnValgrind() > 0,
|
||||
}) break :gpa std.heap.c_allocator;
|
||||
}
|
||||
|
||||
// We don't ever deinit our GPA because the process cleanup will
|
||||
|
Reference in New Issue
Block a user