-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
zig: deallocate a varargs function after applying it #591
Conversation
@asarhaddon sorry for the really slow response on this. I had to make the following change to get things to build (the diff --git a/impls/zig/Dockerfile b/impls/zig/Dockerfile
index 0c6a79eb..024c91d4 100644
--- a/impls/zig/Dockerfile
+++ b/impls/zig/Dockerfile
@@ -20,7 +20,7 @@ WORKDIR /mal
RUN apt-get -y install ca-certificates curl gcc libc-dev libpcre3-dev libreadline-dev xz-utils
-RUN curl https://ziglang.org/download/0.8.1/zig-linux-x86_64-0.8.1.tar.xz | tar -xJC/mal
-RUN ln -fst/usr/local/bin /mal/zig-linux-x86_64-0.8.1/zig
+RUN curl https://ziglang.org/download/0.8.1/zig-linux-x86_64-0.8.1.tar.xz | tar -xJC/opt
+RUN ln -fst /usr/local/bin /opt/zig-linux-x86_64-0.8.1/zig
ENV HOME /mal Then I started getting a segfault in step6:
|
1e63471
to
3aba3a0
Compare
In case this helps, a similar failure is visible with |
Update build system, syntax and library calls for zig 0.13.0. Rewrite the build system so that the steps can build separately. Drop intermediate symbolic links (unneeded complexity, confusing timestamps). Build with debugging options, this is a toy project full of memory leaks. Declare the allocators as global variables instead of passing and/or storing always the same reference everywhere for no benefit. Make apply_function a global variable instead of adding a reference to EVAL in each function. Pass arguments as a slice instead of using a different type for each argument count. There is no point in renaming default errors. Remove a lot of reference counting and some indirection levels. This fixes the current segmentation faults. Create each object as soon as possible and use errdefer so that it is deallocated if an exception occurs when computing its elemements. Use a global variable to convey a MAL object alongside a thrown error. Remove the unused logging_alloc module (but add a debug_alloc boolean in types.zig).
3aba3a0
to
335430d
Compare
@asarhaddon The GHA failure is because the zig binary is under |
@asarhaddon I had forgotten that I have the ability to add commits to a PR (even from others) directly via the UI. Since it was a fairly trivial change, I went ahead and made it and things all passed. Merged. |
This fixes an occasional segmentation fault.