I’m trying to get a speedup for the cpp backend for haxe by using garbage collection. Initial results are very promising – potentially about twice as fast. Howerver I spent a good few hours getting the the bottom of a little problem. Boehm garbage collection is a very impressive piece of work – it has all sorts of magic that does magical things, such as deal with virtual inheritance. This was a bit of a surprise because you do not always get “real” pointers, when you store an object pointer, you get one with an offset. However it seemed to work. Until I added finalizers to the external draw objectes used by the renderer. Apparently, you can only add finalizers to the “real” pointers (ie, those returned from “GC\_MALLOC” et al), rather than a pointer to the same object related by virtual inheritance. The symptom was that the object gets finalized in the first “gc_collect”, even though it was still “used” as far as I was concerned. I guess this is not too surpising, and the fix was pretty easy, but the fact that everything else worked so well lulled be into not suspecting this initially.
Search
Tags
-
Spam
Pages
Posts
- April 2012
- June 2011
- April 2011
- March 2011
- September 2010
- August 2010
- June 2010
- May 2010
- April 2010
- February 2010
- December 2009
- October 2009
- August 2009
- July 2009
- May 2009
- April 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- September 2007
- July 2007
- June 2007
- March 2007
- February 2007
- January 2007
Categories
Meta