|
|
 |
RE: FN-FORUM java
date posted 23rd January 2003 20:56
--=====================_43098859==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed
Garbage collection is non-determinable. In other words it is not possible
to predict when it will take place.
In fact, it may not take place at all.
It is not guaranteed to take place when an application is closed.
Therefore there is no guarantee that objects not in use will be garbage
collected and that their finalizers executed at all.
In other words finalization may ever happen.
In addition there is no guarantee on the order in which objects will be
garbage collected or on the order in which the finalizers will run.
Finalization should be used with extreme care!!!
I know that GC and finalization can be invoked explicitly, however if you
think you might need to do this -- think again -- this is not recommended
unless you are absolutely sure of why you are doing it and what the
consequences are.
===================
lecture over:-)
===================
(Sorry if I've gone over the top with this. Garbage collection and its
implementation was one of my pet subjects a year or two back).
Paul Coleman
At 15:52 23/01/2003 +0000, you wrote:
> > destroy()
> >
> > what is the function of this method and what can it be used
> > for and how and when is it invoked?
>
>It's used to clean up and free resources when you've finished with the
>object. It's usually called declaritively after use. If you don't want
>to have to explicitly destroy() the object, you can override the
>Object.finalize() method which is called by the garbage collector. This
>shouldn't be used by anything like db connections, etc. as garbage
>collection in Java generally only happens when memory is running low and
>could possibly not happen until the application is closed.
>
>Darran.
>
>
>========
>Freelancers and Freelance Jobs: http://www.freelancers.net
>
>Advertise with Freelancers.net http://www.freelancers.net/advert.php
>
>To unsubscribe please email:
[EMAIL REMOVED]
>
>If you have difficulties unsubscribing please email:
[EMAIL REMOVED]
--=====================_43098859==_.ALT
Content-Type: text/html; charset="us-ascii"
Garbage collection is non-determinable. In other words it is not possible
to predict when it will take place.
In fact, it may not take place at all.
It is not guaranteed to take place when an application is closed.
Therefore there is no guarantee that objects not in use will be garbage
collected and that their finalizers executed at all.
In other words finalization may ever happen.
In addition there is no guarantee on the order in which objects will be
garbage collected or on the order in which the finalizers will run.
Finalization should be used with extreme care!!!
I know that GC and finalization can be invoked explicitly, however if you
think you might need to do this -- think again -- this is not recommended
unless you are absolutely sure of why you are doing it and what the
consequences are.
===================
lecture over:-)
===================
(Sorry if I've gone over the top with this. Garbage collection and its
implementation was one of my pet subjects a year or two back).
Paul Coleman
At 15:52 23/01/2003 +0000, you wrote:
> destroy()
>
> what is the function of this method and what can it be used
> for and how and when is it invoked?
It's used to clean up and free resources when you've finished with
the
object. It's usually called declaritively after use. If you
don't want
to have to explicitly destroy() the object, you can override the
Object.finalize() method which is called by the garbage collector.
This
shouldn't be used by anything like db connections, etc. as garbage
collection in Java generally only happens when memory is running low
and
could possibly not happen until the application is closed.
Darran.
========
Freelancers and Freelance Jobs:
http://www.freelancers.net
Advertise with Freelancers.net
http://www.freelancers.net/advert.php
To unsubscribe please email:
|
 |
|