mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +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.versionMajor(version),
|
||||||
gl.glad.versionMinor(version),
|
gl.glad.versionMinor(version),
|
||||||
});
|
});
|
||||||
if (builtin.mode == .Debug) {
|
// These are very noisy so this is commented, but easy to uncomment
|
||||||
var ext_iter = try gl.ext.iterator();
|
// whenever we need to check the OpenGL extension list
|
||||||
while (try ext_iter.next()) |ext| {
|
// if (builtin.mode == .Debug) {
|
||||||
log.debug("OpenGL extension available name={s}", .{ext});
|
// 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) {
|
if (builtin.mode == .Debug) {
|
||||||
// Get our physical DPI - debug only because we don't have a use for
|
// 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
|
// faster than GPA. We only do this in release modes so that we
|
||||||
// can get easy memory leak detection in debug modes.
|
// can get easy memory leak detection in debug modes.
|
||||||
if (builtin.link_libc) {
|
if (builtin.link_libc) {
|
||||||
switch (builtin.mode) {
|
if (switch (builtin.mode) {
|
||||||
.ReleaseSafe, .ReleaseFast => break :gpa std.heap.c_allocator,
|
.ReleaseSafe, .ReleaseFast => true,
|
||||||
else => {},
|
|
||||||
}
|
// 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
|
// We don't ever deinit our GPA because the process cleanup will
|
||||||
|
Reference in New Issue
Block a user