Article View: borland.public.jbuilder.java.swing
Article #11826Re: out of memory - could not GC a LARGE Array,if the arry is the member of JFrame !!!
From: David M. Hewitt
Date: Tue, 30 Mar 1999 00:00
Date: Tue, 30 Mar 1999 00:00
35 lines
1628 bytes
1628 bytes
Without the arry = null; statement, 'arry' is in use by the scrollFrame object
itself
The garbage collector is doing the 'right thing' in this example.
David
> look at the simple program, I think double[] arry can auto GC, but did
> not! I use "java -mx16m" to run. First time click button, it's ok, the
> second click is out of mem. if use "arry=null", it's ok. Do i have to add
> this line ? How can I truely solve this problem ? I want double[]arry is
> the field of ScollFrame. pls help !
>
> public class ScrollFrame {
> ...
> double[] arry;
> void gcTest() {
> arry =new double[1024*1024*1];
> //arry=null;
>
> System.err.println("Beg-----------------------------------------------------
> --");
> System.gc();
> try{
> Thread.sleep(1000);
> }
> catch(InterruptedException e) {
> e.printStackTrace();
> }
>
> System.err.println("End-----------------------------------------------------
> --");
> }
> ...
Technical Details
Message-ID:
<37013475.1CCB31CD@home.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7ccsuc$p2b15@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,2c69af784721fb5 X-Google-Attributes: gid111d45,public From: "David M. Hewitt" <azzigoom@home.com> Subject: Re: out of memory - could not GC a LARGE Array,if the arry is the member of JFrame !!! Date: 1999/03/30 Message-ID: <37013475.1CCB31CD@home.com> X-Deja-AN: 460881168 Content-Transfer-Encoding: 7bit References: <7ccsuc$p2b15@forums.borland.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing