You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ideally, there should be a garbage-collected wrapper looking something like this:
type CVmem
handle :: Ptr{Void}
function CVmem(lmm::Cint, iter::Cint)
mem = new(CVodeCreate(lmm, iter))
mem.handle == C_NULL && error("CVodeCreate failed")
finalizer(mem, CVodeFree)
mem
end
end
convert(::Type{Ptr{Void}}, mem::CVmem) = mem.handle
CVodeFree(mem::CVmem) = ccall((:CVodeFree, Sundials.libsundials_cvodes), Void, (Ptr{Ptr{Void}},), &mem)
Of course, the garbage collector won't always collect the memory aggressively if Sundials uses a lot of it, but it is much more "julia-like" to try to collect these pointers than to expect the user to call create/free pairs.
The text was updated successfully, but these errors were encountered:
Ideally, there should be a garbage-collected wrapper looking something like this:
Of course, the garbage collector won't always collect the memory aggressively if Sundials uses a lot of it, but it is much more "julia-like" to try to collect these pointers than to expect the user to call create/free pairs.
The text was updated successfully, but these errors were encountered: