//From Marcus Daniels August 24, 2001 swarm-support

// "MA" == Myriam Abramson <abramson@aic.nrl.navy.mil> 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", "bug-swarm@swarm.org", 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);
    }
}

