[omniORB] Re: Object Reference Rules

David Riddoch djr@uk.research.att.com
Thu, 25 Mar 1999 11:57:20 +0000 (GMT)


On Wed, 24 Mar 1999, Armen Yampolsky wrote:

> David, thank you for your quick response!
> 
> Unfortunately, even with this simple example, using your suggested code
> (Method 3, which you label "if you want to be able to get() again"), we see a
> memory leak on the server. The relevant client code looks something like
> this:

This is very strange.  We've just tried a similar example here, and both
the client and server are stable at about 3 MB in size.

We need to think again.
David


> 
> ----------- Java client -----------
> 
> ObjFactory factory = .....;  //get from NameService
> ObjectHolder holder = .....; //get from NameService
> SimpleObject object = SimpleObjectHelper.narrow(factory.createObj());
> 
> //this loop will cause the server's memory to swell linearly:
> while (true)
> {
>     holder.put(object);
>     object = holder.get();
>     object.count(7);
> }
> 
> // in real life, eventually we would release the
> // newly instantiated object...
> object.kill();
> 
> ----------- end Java code -----------
> 
> In other words, we want to re-get and re-put the same servant reference
> (independently) as many times as we want.
> 
> Any ideas?
> -Armen