swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: memory leaks(java)


From: Marcus G. Daniels
Subject: Re: memory leaks(java)
Date: 24 Aug 2001 14:22:27 -0600
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.7

>>>>> "MA" == Myriam Abramson <address@hidden> writes:

MA> I'm using the java interface and of course some swarm objects. I
MA> think I've used as many deleteAll() and drop() as I can but
MA> there's still a big memory leak and I have to scale up the
MA> simulation. Is there anything in Java I can do to detect where the
MA> bottleneck occurs?

Here's an example of how to track statistics and the population of a Zone.

There are two built-in Zones, Globals.env.globalZone and
Globals.env.scratchZone, and then you can create others (and Swarms
double as Zones).  In Java, you should be able to find anything from
Swarm you're allocating in a Zone.  The rest will be garbage
collected.

(Note that garbage collection won't ensure you don't have leaks, as you
can mistakenly be accumulating objects in a data structure.)

import swarm.Globals;
import swarm.defobj.ZoneImpl;
import swarm.defobj.Zone;
import swarm.objectbase.SwarmObjectImpl;

public class ShowZone {
    static void main (String args[]) {
        Globals.env.initSwarm ("ShowZone", "0.0", "address@hidden", args);
        
        Zone zone = new ZoneImpl (Globals.env.globalZone);
        new SwarmObjectImpl (zone);

        System.out.println ("statistics");
        Globals.env.xprint (zone);
        System.out.println ("members");
        Globals.env.xfprint (zone);
    }
}

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]