[omniORB] memory leak in omniNames with python
Duncan Grisby
dgrisby@uk.research.att.com
Fri, 05 Oct 2001 16:38:50 +0100
On Friday 5 October, Mathieu de Naurois wrote:
> My omniNames server is leaking memory when I list the content of a
> context from python.
[...]
> l = rootContext.list(100)
> del l
The list() operation is declared in IDL as
void list(in unsigned long how_many,
out BindingList bl,
out BindingIterator bi);
That means the return value in Python is a tuple of the two out
values: the list and a reference to a BindingIterator object.
In the case that list() returns all the bindings in a single call,
there is no need for the iterator. The Naming service specification
allows the server to return a nil object reference, but it doesn't
have to. omniNames currently always returns an iterator, even if it's
useless.
So, the leak you are seeing is the BindingIterator. You should call
its destroy() operation to clean it up properly:
bl, bi = rootContext.list(100)
if bi is not None:
bi.destroy()
Cheers,
Duncan.
--
-- Duncan Grisby \ Research Engineer --
-- AT&T Laboratories Cambridge --
-- http://www.uk.research.att.com/~dpg1 --