Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Garbage collection not happening?

Re: Garbage collection not happening?

From: Jacy Grannis <jacygrannis_at_yahoo.com>
Date: 3 Sep 2002 14:44:28 -0700
Message-ID: <b94ddb06.0209031344.6970560d@posting.google.com>

aflynn_at_mrcuk.com (adam) wrote in message news:<4c3a15f9.0209020306.59814ee7_at_posting.google.com>...
> > MyObject mo;
> > List l = new ArrayList();
> > while (rs.next())
> > {
> > mo = new MyObject();
> > mo.setData1(rs.getString("data1"));
> > mo.setData2(rs.getString("data2"));
> > ...many more similar calls...
> > l.add(mo);
> > }
>
> In the example you gave above none of the MyObjects can get garbage
> collected because each one has a reference remaining within the array
> list. In the second example you gave below, the objects are all
> available for garbage collection straight away.
>
> > for (int i = 0; i < 10000; i++)
> > {
> > new ArrayList(10000);
> > new String();
> > new StringBuffer(100000);
> > }
>
> In short, objects are only available for garbage collection when the
> garbage collector determines that the program can no longer access
> them. Even then, there is no guarantee when or if redundant objects
> will be collected: it pretty much depends on the garbage collector
> implementation.

This is true, but you're not understanding my problem. Those two examples had not much to do with each other. The first example is my real code. The second example was test code I wrote to be able to examine the gc behavior standalone vs. under iPlanet. I expected the objects in the second example to be garbage collected. What was notable is that when I ran that second example under iPlanet, the objects were *not* garbage collected, but when I ran the example as a standalone app, they were.

as for the first example, the MyObjects are not the objects I expect to be garbage collected. It is the temporary objects created by the Oracle driver that should be being garbage collected. How do I know they should be being garbage collected? They are getting collected when I run the query as a standalone app. They are not getting garbage collected when I run the query under iPlanet (but still using the same VM, which means it is still using the same garbage collector implementation). The question is not "why am I not seeing deterministic garbage collection?" The question is, "What is iPlanet doing? Are they setting some variable in the VM or what that keeps the garbage collection from happening?" Received on Tue Sep 03 2002 - 16:44:28 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US