Samium Gromoff wrote:
> I'm not sure these "freedom" patches DTRT.
> 
> I'm not sure why, but i see occasional memory errors.
> 
> Without these, otoh, it does not work at all -- a double-free happens.
> 

I think I know why this is happening but I'll only be able to patch the
code tonight.

When the ttf library is closed (either explicitly or when SDL:WITH-INIT
ends) it free's all font resources. Trouble is when the garbage
collector garbage collects a font it also tries to free the font
resources. If the garbage collect happens after WITH-INIT... Bang!

I'm going to have to add a *generation* counter. Each time the font
library is closed the generation counter is increased. Then add a test
in the CFFI finalization method to test if the font to be free'd was
created in the current *generation*. If it was not then the font cannot
be freed.

- Luke


_______________________________________________
application-builder mailing list
[email protected]
http://www.lispniks.com/mailman/listinfo/application-builder

Reply via email to