Mirror of
forum.nim-lang.org
index
9644 :: Is it allowed to use dealloc instead of free?
[2022-11-23T15:33:48+01:00]
View Orginal
sls1005
(orginal)
[2022-11-23T15:33:48+01:00]
view original
Is it allowed to use
dealloc
in Nim to free a C object allocated in C (via
malloc
)?
Araq
(orginal)
[2022-11-23T15:39:46+01:00]
view original
No, definitely not.
malloc
requires
free
and
alloc
requires
dealloc
and
new
requires
delete
.
xigoi
(orginal)
[2022-11-23T20:05:29+01:00]
view original
How do you
free
in Nim?
planetis
(orginal)
[2022-11-23T20:11:06+01:00]
view original
Just do
import system/ansi_c
there is
c_malloc
and
c_free