Article View: borland.public.jbuilder.java.api
Article #2592Re: Why Java Program eats Memory?!
From: Ali Demir
Date: Wed, 20 Sep 2000 00:00
Date: Wed, 20 Sep 2000 00:00
52 lines
1979 bytes
1979 bytes
He needs to assign null to the last instance of the mt2 only, the previous
mt2's reference is already gone by assigning a new thread object to it...
ali
"Joi Ellis" <joi@aravox.com> wrote in message
news:39C7D2AE.9BC2E7D0@aravox.com...
> banxuegang wrote:
> >
> > HI,
> > Thank you for your help. But it is hard to post my source codes here, it
is
> > too long.
> > But something like below:
> >
> > class myThread1 extends Thread
> > {
> > ......
> > public void main()
> > {
> > myThread1 t1=new myThread1();
> > myThread1 t2=new myThread1();
> > t1.start();
> > t2.start();
> > }
> >
> > public void run()
> > {
> > while(true)
> > {
> > myThread2 mt2=new myThread2();
> > mt2.start();
> > ....
> > }
> > }
>
> Erf. Okay, so every type this loop runs, you're firing
> off a new thread. Do you ever assign null back to mt2?
> Is anything else storing a reference to mt2?
>
> Does mt2.run() ever exit?
>
>
>
> --
> Joi Ellis Software Engineer
> Aravox Technologies joi@aravox.com, gyles19@visi.com
>
> No matter what we think of Linux versus FreeBSD, etc., the one thing I
> really like about Linux is that it has Microsoft worried. Anything
> that kicks a monopoly in the pants has got to be good for something.
> - Chris Johnson
Technical Details
Message-ID:
<39c89b76$1_1@dnews>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<39c28555$1_2@dnews> <39C6DA10.C8A4B4D2@aravox.com> <39c77da2$1_2@dnews> <39C7D2AE.9BC2E7D0@aravox.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,80c63c7225823056 X-Google-Attributes: gid1089d0,public From: "Ali Demir" <ademir@informix.com> Subject: Re: Why Java Program eats Memory?! Date: 2000/09/20 Message-ID: <39c89b76$1_1@dnews> X-Deja-AN: 671994122 References: <39c28555$1_2@dnews> <39C6DA10.C8A4B4D2@aravox.com> <39c77da2$1_2@dnews> <39C7D2AE.9BC2E7D0@aravox.com> X-Trace: 20 Sep 2000 04:11:50 -0800, 24.19.144.88 X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: borland.public.jbuilder.java.api X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700