I am working on a project that need to deal with pointers, but I have some questions:
If I use
Pointer.malloc, when the memory will be freed ? I guess it’s when it’s collected by the GC, but Pointer is a
Value, so isn’t there a specific behavior for Pointers?
What append if I copy the address somewhere into a Int64, and reuse this address by doing
Pointer.new(address).value .... GC can’t detect this probably?
If I want to be sure that the address keep allocated until I freed it myself, have I to use
Ideally, I would like indicate to the GC that the address of the pointer is stored elsewhere into and other variable, and to don’t free this pointer until there are no references on my pointer and my variable.
GC.register_disappearing_linkis what I am looking for?, how can I use this function in this case?
Thanks you for enlighten me !