Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Garbage Collector question?


  • From: yogesh@xxxxxxxxx (Yogesh Pandeya)
  • Subject: Garbage Collector question?
  • Date: Tue, 30 Nov 1999 15:45:01 -0000

Hi Srihari,
Its not always the case that gc runs as a low priority thread. When the =
JVM runs short of memory, gc runs at high priority to reclaim space. If =
it could not get space by gc, it(JVM) gets more memory from the =
system.(correct me Gurus if I am wrong)

About temperory objects....
If you are declaring an object handle locally, and assigning new object =
to it, it will be gabage collected if it goes out of scope. If you are =
declaring the handle at the top level, and allocate a new object to it, =
it will hang around with you unless you assign it to null. This kind of =
memory leaks are programer's creation and he/she has to take care of it.
If you need to create many objects locally many times, its always a good =
idea to use object pool as it will improve the performance significantly =
as "new" is a costly affair.
Does this make sense or I am missing somthing???
regards,
Yogesh


-----Original Message-----
From:	Shrihari.S.C [SMTP:sriharis@xxxxxxxxxxxxxxxxxxxx]
Sent:	Tuesday, November 30, 1999 2:41 PM
To:	Java Mail List
Cc:	yogesh@xxxxxxxxx
Subject:	RE: Garbage Collector question?

Hi Yogesh,
	The System.gc() is a low priority thread that cleans those set of =
objects
that are not from the primordial class loader , but from the custom =
class
loader and those which has been assigned null. But considering the fact =
that
the class contains too many objects that have been temporarily created
because of some intermediate computation and have not been assigned =
null,
before which the computation is exited, the System.gc() siezes to work
because of improper set of unreferenced objects to be deallocated. What =
do u
think can be set of other options left out to see this problem ?
			Regards
								Shrihari
> -----Original Message-----
> From: Yogesh Pandeya [mailto:yogesh@xxxxxxxxx]
> Sent: Tuesday, November 30, 1999 7:32 PM
> To: 'magesh@xxxxxxxxxxxxxxxx'; 	 punam
> chordia
> Subject: RE: Garbage Collector question?
>
>
>
> Hi Magesh,
> Another sequence on gc!!!! Anyway.....
>
> Putting System.gc() doesn't guarantee that it will run when you
> want to. Its VM's prerogative to run gc or not. It is guaranteed
> run at the point you put System.gc(), only if you run the
> application with -noclassgc (or -Xnoclassgc) option.
> Other point to note is, if you are creating objects temporarily,
> you can use an object pool and reuse your objects. There is good
> article this month's Javaworld.
> Hope it helps,
> cheers,
> Yogesh
>
>      -----Original Message-----
> From:	magesh@xxxxxxxxxxxxxxxx [SMTP:magesh@xxxxxxxxxxxxxxxx]
> Sent:	Tuesday, November 30, 1999 1:23 PM
> To:	advanced-java@xxxxxxxxxxxxxxxx; punam chordia
> Subject:	RE: Garbage Collector question?
>
>
>
> Hi,
>
> Does this guarantee that the System.gc() will run without getting =
context
> switched
> because it has a low priority??
>
> thanks,
> mmp.
>
>
>
>
>
> punam chordia <punamac@xxxxxxx> on 11/30/99 02:44:03 AM
>
> To:   Mageshkumar Maruthapillai/Technology Providers/lk
> cc:
> Subject:  RE: Garbage Collector question?
>
>
>
>
> We also had a similar problem.
> U can run garbage collector explicitly by writing the following line =
of
> code,
> System.gc();
> I hope it helps you.
> Punam Chordia
> Software Engineer
> ITL Infosys, Pune.
> Ph. 91-020-647420/1 Extension: 1046
> > -----Original Message-----
> > From:   magesh@xxxxxxxxxxxxxxxx [SMTP:magesh@xxxxxxxxxxxxxxxx]
> > Sent:   Tuesday, November 30, 1999 PM 01:06
> > To:     advanced-java@xxxxxxxxxxxxxxxx
> > Subject:     Garbage Collector question?
> >
> >
> >
> > Hi,
> >
> >     My server code is consuming a lot of memory dur to a large =
number
> > of objects being created temporarily.
> >
> > I want to be able to get a reference to the garbage collector
> > of the virtual machine so that I can give it a high priority to it
> > very short intervals intermittently.
> >
> >
> > Is there a way to get the reference to the garbage collector?
> >
> >
> > any help is appreciated.
> >
> > thanks,
> > mmp
> >
> >
> >
> > ---
> > To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
> > To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
>
>
>
>
>
> ---
> To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
> To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
>
> ---
> To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
> To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx



---
To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx