lua-users home
lua-l archive

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


On Thu, Jul 10, 2003 at 05:40:27PM -0500, RLake@oxfam.org.pe wrote:
> My favorite solution: Keep a table in the registry keyed by the address of 
> the Delphi object, whose values are the heavy-user data. 

If you do not want to waste memory and slow down GC with proxies to objects
that exist long but are seldom used in Lua code, you should also make the 
table weak and recreate a proxy whenever one is needed and does not exist
in the cache table.

> Also, you do not technically need a separate 
> table; you can simply use the registry as long as you follow the 
> convention (followed by the Lua libraries) that a lightuserdata used as a 
> key in the registry is always the address of allocated storage.

But can't this (in theory at least) conflict with the reference system?

-- 
Tuomo