Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build.zig: Support ignore_free #625

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ pub fn build(b: *std.Build) void {
"Support for atomic uncollectible allocation") orelse true;
const enable_redirect_malloc = b.option(bool, "enable_redirect_malloc",
"Redirect malloc and friend to GC routines") orelse false;
const enable_ignore_free = b.option(bool, "enable_ignore_free",
"Ignore calls to free") orelse false;
const enable_disclaim = b.option(bool, "enable_disclaim",
"Support alternative finalization interface") orelse true;
const enable_dynamic_pointer_mask = b.option(bool,
Expand Down Expand Up @@ -303,6 +305,10 @@ pub fn build(b: *std.Build) void {
}
}

if (enable_ignore_free) {
flags.append("-D IGNORE_FREE") catch unreachable;
}

if (enable_mmap or enable_munmap) {
flags.append("-D USE_MMAP") catch unreachable;
}
Expand Down
2 changes: 1 addition & 1 deletion malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ GC_API void GC_CALL GC_free(void * p)
void free(void * p)
{
# ifdef IGNORE_FREE
# UNUSED_ARG(p);
ivmai marked this conversation as resolved.
Show resolved Hide resolved
UNUSED_ARG(p);
# else
# if defined(GC_LINUX_THREADS) && !defined(USE_PROC_FOR_LIBRARIES)
/* Don't bother with initialization checks. If nothing */
Expand Down
Loading