Maybe finalizer() will do what you need? http://julia.readthedocs.org/en/latest/stdlib/base/#Base.finalizer
On Saturday, March 15, 2014 9:49:56 AM UTC-5, Kenta Sato wrote: > > Hi everyone, > > I'm wondering if there are "smart pointers" like C++ in Julia. > Calling C functions often require managing raw pointers allocated in the C > functions. > After allocating a pointer, I want to wrap it up with a smart pointer, > which automatically frees the raw pointer when the smart pointer itself is > removed with a garbage collector. > As for pointers to an array, the `pointer_to_array` method seems to be > suitable in this case ( > http://docs.julialang.org/en/latest/stdlib/base/#Base.pointer_to_array). > > More generally speaking, I want a functionality that is something like a > destructor to manage resources more readily. > Is it possible to call a function just before a Julia object is destructed? > > Thanks. >
