[Cffi-devel] What is the proper way to do GC in CFFI
Willem Rein Oudshoorn
woudshoo at xs4all.nl
Sun Apr 13 07:28:24 UTC 2014
Joeish W <joeish80829 at yahoo.com> writes:
> I have Lisp functions that wrap C wrappers for C++ functions that
> contain a new operator. The C wrappers have to stay the same I can't
> change those but I was advised to update my method of GC.
As already mentioned before, use the package 'trivial-garbage'.
The cl-git package that wraps the libgit2 C code might be a good
example.
The cl-git code tries the handle automatic freeing by the garbage
collector, but also allows you to free manually.
In addition it keeps track of dependencies, e.g. in cl-git
a 'commit' is only valid as long as the 'repository' is open.
It is not much code and might give some inspiration.
Disclaimer, I was quite involved in this bit of cl-git, the
project is on github:
https://github.com/russell/cl-git
As an additional question, maybe not well suited for this list.
I see you are wrapping the OpenCV code. There are already two
other wrappers. So I am curious what are the deficiencies of the
existing wrappers that your wrapper tries to solve?
Wim Oudshoorn.
More information about the cffi-devel
mailing list