Switched the gc to ORC for better performance and added the useMalloc flag for better debugging and memory corruption detection

This commit is contained in:
Nocturn9x 2021-12-01 12:18:13 +01:00
parent e7bd635574
commit ddca38c84b
2 changed files with 4 additions and 1 deletions

View File

@ -5,7 +5,7 @@ WORKDIR /code
# Removes any already existing binary so that when compilation fails the container stops
RUN rm -f /code/nimd
RUN nim -d:release --opt:size --passL:"-static" c -o:nimd src/main
RUN nim -d:release --opt:size --passL:"-static" --gc:orc -d:useMalloc c -o:nimd src/main
RUN cp /code/nimd /sbin/nimd
FROM alpine:latest

View File

@ -58,6 +58,9 @@ proc parseFileSystemTable*(fstab: string): seq[tuple[source, target, filesystemt
# Nim wrappers around C functionality in sys/mount.h on Linux
proc mount*(source: cstring, target: cstring, filesystemtype: cstring,
mountflags: culong, data: pointer): cint {.header: "sys/mount.h", importc.}
# Since cstrings are weak references, we need to convert nim strings to cstrings only
# when we're ready to use them and only when we're sure the underlying nim string is
# in scope, otherwise garbage collection madness happens
proc mount*(source, target, filesystemtype: string, mountflags: uint64, data: string): int = int(mount(cstring(source), cstring(target), cstring(filesystemtype), culong(mountflags), cstring(data)))
proc umount*(target: cstring): cint {.header: "sys/mount.h", importc.}