-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
$ nim -v
Nim Compiler Version 1.1.1 [Linux: amd64]
Compiled at 2020-01-15
Copyright (c) 2006-2019 by Andreas Rumpf
git hash: d88b52c0bc505db42ba6561518c9ee9b21a99e81
active boot switches: -d:release
type
Object* = ref object of RootRef
impl*: pointer
type
InitiallyUnowned* = ref object of Object
type
Widget* = ref object of InitiallyUnowned
proc finalizeGObject*[T](o: ref T) =
echo "finalizeGObject"
proc main =
var w: Widget
new(w, finalizeGObject)
echo "OK"
main()3 $ nim c -r t0.nim
Hint: used config file '/home/stefan/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/stefan/Nim/config/config.nims' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: t0 [Processing]
CC: stdlib_io.nim
CC: stdlib_system.nim
CC: t0.nim
Hint: gcc -o /tmp/gtk3/t0 /tmp/stefan/.cache/nim/t0_d/stdlib_io.nim.c.o /tmp/stefan/.cache/nim/t0_d/stdlib_system.nim.c.o /tmp/stefan/.cache/nim/t0_d/@mt0.nim.c.o -ldl [Link]
Hint: 22185 LOC; 0.410 sec; 24.613MiB peakmem; Debug build; proj: /tmp/gtk3/t0.nim; out: /tmp/gtk3/t0 [SuccessX]
Hint: /tmp/gtk3/t0 [Exec]
OK
stefan@nuc /tmp/gtk3 $ nim c --gc:arc t0.nim
Hint: used config file '/home/stefan/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/stefan/Nim/config/config.nims' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: t0 [Processing]
CC: stdlib_io.nim
CC: stdlib_system.nim
CC: t0.nim
Hint: gcc -o /tmp/gtk3/t0 /tmp/stefan/.cache/nim/t0_d/stdlib_allocators.nim.c.o /tmp/stefan/.cache/nim/t0_d/stdlib_io.nim.c.o /tmp/stefan/.cache/nim/t0_d/stdlib_system.nim.c.o /tmp/stefan/.cache/nim/t0_d/@mt0.nim.c.o -ldl [Link]
Hint: 20027 LOC; 0.298 sec; 19.695MiB peakmem; Debug build; proj: /tmp/gtk3/t0.nim; out: /tmp/gtk3/t0 [SuccessX]
stefan@nuc /tmp/gtk3 $ ./t0
out of memory
But with valgrind it seems to work:
$ valgrind ./t0
==9971== Memcheck, a memory error detector
==9971== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==9971== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==9971== Command: ./t0
==9971==
OK
finalizeGObject
==9971==
==9971== HEAP SUMMARY:
==9971== in use at exit: 0 bytes in 0 blocks
==9971== total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
==9971==
==9971== All heap blocks were freed -- no leaks are possible
==9971==
==9971== For lists of detected and suppressed errors, rerun with: -s
==9971== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)