Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Newbie: memory leak in CORBA program, JVM grows

38 views
Skip to first unread message

blpp

unread,
Jun 21, 2004, 8:11:27 AM6/21/04
to
Hello NG,

I have a client and server program. The server is running java, the
client in java or c++. They both communicate with the help of CORBA:

1. The client asks the server to distribute a new object
2. The client performs some action on this object and receives
results
3. The client signalizes that the server can throw the object away

The whole procedure works quiet good, I receive all results correct.
The objects are found with the help of an name service.

But running some tests displayed some kind of memory leakage. The JVM
becomes bigger and bigger.
So I began to read the NG here on google (read several hours) and
tried many different things, but finally the memory leakage is not
gone.

I think I'm missing some kind of release mechanism. I extracted the
important lines of code from my server application running in java:

================
initialization
================

NamingContextExt ncRef;
POA rootPOA;
ORB orb;
org.omg.CORBA.Object objRef;

orb = ORB.init(args, System.getProperties());

rootPOA = (POA)orb.resolve_initial_references("RootPOA");
rootPOA.the_POAManager().activate();

objRef = orb.resolve_initial_references("NameService");

ncRef = NamingContextExtHelper.narrow(objRef);

=====================
object distribution
=====================

AObject myObject = new AObject();

org.omg.CORBA.Object obj = AObjectHelper.narrow(
getRootPOA().servant_to_reference(myObject) );

ncRef.rebind(APathName, obj);

//save myObject in Treemap

================
object removal
================

ncRef.unbind( ncRef.to_name(APathName) );

getRootPOA().deactivate_object( getRootPOA().reference_to_id(myObject)
);

//remove myObject from Treemap


If I put a System.out.println() in the constructor and finalize-method
of the object i distribute I can only see the constructor message. The
finalize method is never called.

What am I doing wrong, any help is really appreciated.


Regards

Mario Freimann

PS: I'm running on Windows 2000 Server SP4, JVM version is 1.4.1.

blpp

unread,
Jun 28, 2004, 10:23:47 AM6/28/04
to
Just for other people that have the same problem:

I downloaded a test version of the program "Borland Optimizeit Suite
6". With the help of this program I realized, that my Objects
(AObject) were released correctly . The memory problem I had was
caused by not releasing some other objects. My functions were
returning some objects. These objects (Any-Object) were not released
like the normal AObject.

After releasing all objects The memory leak is gone.

0 new messages