I am guessing (hoping) the answer is never. That such memory must be explicitly freed.
For example if if I wrote:
julia> x = Libc.malloc(1_000_000)
Ptr{Void} @0x0000000002f6bd80
julia> x = nothing
have I just leaked ~1MB of memory?
However I am not 100% certain this is true, because the docs don't mention it at all.
help?> Libc.malloc(3)
malloc(size::Integer) -> Ptr{Void}Call malloc from the C standard library.
Yes, you are correct.
Julia is designed to seamlessly interoperate with C on a low level, so when you use the C wrapper libraries, you you get C semantics and no garbage collection.
The docs for Libc.malloc is not written to teach C, but could be improved to mention Libc.free, in case anyone gets confused.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With