lua-users home
lua-l archive

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


Erik Cassel wrote:
Don't forget to remove the key-value pair after the COM object is gone... or
you'll start to leak registry memory.  Does your usedata's destructor clean
up its own registry entry?
That's not necessary.  As I attempted to explain earlier, the userdata 
references aren't stored directly in the registry, but in a table 
referenced by the registry.  The table which references the userdata has 
a metatable, and that metatable's __mode value is "v", so the values are 
weak references; the garbage collector will do the necessary cleanup 
itself; my __gc metamethod only has to release the wrapped COM object. 
See the Weak Tables chapter in _Programming in Lua_ (http://lua.org/pil/).
I hope this helps.
--
Matt Campbell
Lead Programmer
Serotek Corporation
www.freedombox.info
"The Accessibility Anywhere People"