[Cffi-devel] I can use a little professional advice on my new memory management technique(read this for a fun idea)
Joeish W
joeish80829 at yahoo.com
Wed May 7 08:04:17 UTC 2014
Probably about 30% of my functions need some sort of memory management. I wanted to use the TG(Trivial Garbage) finalizers for automatic MM but
they were twice as slow as my original functions. So I decided to use 3
forms of MM in my library WITH-* macros, manual and finalizers. As for
the finalizer part of my library, I wanted to call all my functions by
the same name as well so I tried 2 things. First I wrapped everything
in conditionals so I could call by the same name but that was a bit
slow...so I decided to create a clone of my library named "GC" that had
all the same functions but they were finalized. so If, while in my
original package, where I normally use with-* macros because they are
quickest, I needed one, I could append a "gc::" before the function I
wanted to use and bam!, a finalized version of the function I wanted to
use, with the same name(save for the gc::) and as fast as possible. The
only caveat is If I use one finalizer I have to append a "gc::" to thee
front of every function that takes that function as input. Once the
branching for that function is over, I can do whatever I want with the
rest of the functions in my code..Now I can tell you this is awesome and fun to use....but is there another better way
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20140507/c2c66344/attachment.html>
More information about the cffi-devel
mailing list