>From Ian Clarke <ian at freenetproject.org>

>java -Xrunhprof:heap=sites,depth=4,format=a freenet.node.Main

As expected, the memory used when a 498 node blows up is mostly storing the 
announcement events for the hopefully fixed announcement bug, but I also 
noticed that in StateChain.java:

L19:
    public static boolean KEEP_HISTORY = false;

    protected State state;

    protected Vector history = new Vector();
[...]
L51:
    public synchronized boolean received(Node node, NodeMessageObject mo) {
        state = received(state, node, mo);
        history.addElement(new StateRecord(mo.toString(),
                                           state == null ? null :
                                           state.getClass(),
                                           System.currentTimeMillis()));
        return state != null;
    }


With KEEP_HISTORY set to false (it isn't changed anywhere in the code as far 
as i can see) nothing is ever done with the history vector, but stores a 
pretty large amount of data anyway, making StateChain objects much larger than 
they need to be.

Can someone confirm that it would be okay to:
1. put an "if (KEEP_HISTORY)" around the history.addElement call; and
2. make KEEP_HISTORY final so that it gets optimized away by the compiler?

--
Benjamin Coates


_______________________________________________
devl mailing list
devl at freenetproject.org
http://hawk.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to