[Gc] Warnings from the garbage collector: a little light humour

Andrew Haley aph at redhat.com
Fri May 12 06:34:48 PDT 2006


During runs of the JOnAS test suite I kept seeing messages like

GC Warning: Repeated allocation of very large block (appr. size 1200128):
	May lead to memory leak and poor performance.

so I naturally assumed there was some sort of problem with either the
gc or with the gcj runtime library.  After a little while debugging, I
found this gem:


public class TargetSL implements SessionBean {

    static protected Logger logger = null;
    SessionContext ejbContext;

    public String string;
    public int number;
    public  boolean createdViaCreateXX;
    public  boolean createdViaCreateYY;
    private int [] inttable = new int[300000];


And, almost needless to say, inttable isn't referenced by any code!

In more recent JOnAS releases, there has been a change:


public class TargetSL implements SessionBean {

    static protected Logger logger = null;
    SessionContext ejbContext;

    public String string;
    public int number;
    public  boolean createdViaCreateXX;
    public  boolean createdViaCreateYY;
    private int [] inttable = new int[30];


And I find this ChangeLog entry:

Revision 1.8 /, Fri Dec 17 15:46:15 2004 UTC (16 months, 3 weeks ago) by durieuxp
Branch: MAIN
CVS Tags: jonas_4_4, jonas_4_3, JONAS_4_4_3, JONAS_4_4_2, JONAS_4_4_1, JONAS_4_3_5, JONAS_4_3_4, JONAS_4_3_3, JONAS_4_3_2, JONAS_4_3_1

reduce size of bean session to avoids outOfMemory


inttable _still_ isn't used by anyone.  :-)

I guess the idea was some sort of memory stress test.

Andrew.


More information about the Gc mailing list