lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> I sometimes
> find that my application is choking on large, cached
> pixmaps and textures. I
> need to have something happen to drive the garbage
> collector forward ...

I ran into this in the exact same way (handling
pixmaps).  A quick 'hack' could be to give
lua_newuserdata an additional size_t parameter that
indicates the extra amount of space related to this
udata (can be 0).  The implementation is pretty
simple: luaS_newudata (in lstring.c) also gets this
extra parameter and simply stores the sum of actual
and extra size in the 'len' field of the new udata. 
Changes are minimal (lua_boxpointer macro should
change as well).

The 'extra' size will be fixed after creation though. 
This may or may not be a problem?

Makes some sense?


Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!