[ab] [FIX] make lispbuilder-sdl-ttf "less free"
Luke J Crook
luke at balooga.com
Sun Feb 4 11:40:03 CST 2007
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
More information about the application-builder
mailing list