Next: 5.4.3 Receiving events
Up: 5.4 Important issues about
Previous: 5.4.1 Problems instantiating COM
Contents
Next: 5.4.3 Receiving events Up: 5.4 Important issues about Previous: 5.4.1 Problems instantiating COM Contents Fabio Mascarenhas de Queiroz 2005-01-07
5.4.2 Releasing COM objects from memory
In a normal scenario, an out-of-process COM server should terminate when all references to its objects are released. This may be importart, as the creation of new instances might depend on the absence of a running one. LuaCOM integrates the standard COM mechanism of reference counting with Lua's garbage collection. This works fine in most situations, but there are some situations which demand a more careful analysis:
- to immediately terminate the server process, it's necessary to eliminate all references in Lua to the COM objects residing in this process and then force a garbage-collection cycle;
- sometimes a reference to a COM object may be stored by mistake to a global variable and then forgot there. This may prevent the server process to exit even when a method like ``Quit'' is called. To avoid this problem, one might group all to references to a COM object and its sub-objects in a single table to avoid ``lost'' references.
For more information, see section 3.2.1.
Next: 5.4.3 Receiving events Up: 5.4 Important issues about Previous: 5.4.1 Problems instantiating COM Contents Fabio Mascarenhas de Queiroz 2005-01-07