[omniORB] Object::_nil()
David Riddoch
djr@uk.research.att.com
Sat, 6 Jan 2001 15:44:31 +0000 (GMT)
Hi,
It is actually impossible to implement nil object references in a way that
does not leak any memory at all. omniORB does technically 'leak memory'
in this case, in the sense that it allocates an object that it never
deletes. However this is a singleton -- it does not leak more and more
memory as time goes on.
The reason for this is that we have to guarentee that the nil object
reference will be around at least as long as any _var instances that
reference it. The _var objects might be static objects, in which case we
can make no assumptions about when they will be destroyed. Thus the nil
singleton has to be dynamically allocated, and we cannot ever delete it.
Cheers,
David
On Fri, 5 Jan 2001, David Hyde wrote:
> I am using OmniORB on winnt to build a COM control. From what I have read
> (Henning and Vinoski) calling _nil() on an object is guaranteed not to leak
> any resources even if CORBA::release() is not called using the returned
> reference. I am calling CORBA::release() on it, but Visual C++ is still
> reporting a memory leak when the application shuts down.
>
> Does anyone know why?