-
September 8th, 2009, 12:35 PM
#1
Finalize method()
can u please give me any code that can clearly describe the use of finalize()....
-
September 8th, 2009, 03:37 PM
#2
-
September 9th, 2009, 03:32 PM
#3
Re: Finalize method()
sorry, couldn't stay quiet...
Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?
I had a nightmare last night. I was dreaming that I’m 64-bit and my blanket is 32-bit and I couldn’t cover myself with it, so I’ve spent the whole night freezing. And in the morning I find that my blanket just had fallen off the bed. =S (from: bash.org.ru)
//always looking for job opportunities in AU/NZ/US/CA/Europe :P
willCodeForFood(Arrays.asList("Java","PHP","C++","bash","Assembler","XML","XHTML","CSS","JS","PL/SQL"));
USE [code] TAGS! Read this FAQ if you are new here. If this post was helpful, please rate it!
-
September 10th, 2009, 01:50 AM
#4
Re: Finalize method()
Originally Posted by arpit2309
can u please give me any code that can clearly describe the use of finalize()....
In principle you should avoid finalizers. Although a little dated this article tells you why. See "finalizers are not your friend",
http://www.ibm.com/developerworks/li...-jtp01274.html
-
September 10th, 2009, 08:44 AM
#5
Re: Finalize method()
Originally Posted by nuzzle
This is true. Don't count on yourself being smarter about releasing resources than the JVM. I'm guessing that while with 1.6 and soon to be 1.7 calling finalize on an object may not be as expensive of a call, it's analogous to calling System.gc(); <-- you better have a very good reason as to why you are doing that.
------
If you are satisfied with the responses, add to the user's rep!
-
September 10th, 2009, 09:00 AM
#6
Re: Finalize method()
Originally Posted by Deliverance
Don't count on yourself being smarter about releasing resources than the JVM. I'm guessing that while with 1.6 and soon to be 1.7 calling finalize on an object may not be as expensive of a call, it's analogous to calling System.gc(); <-- you better have a very good reason as to why you are doing that.
The main problem is that there's no guarantee when - if ever - the finalizer will be called, so there's little point doing anything important there anyway.
Less is more...
M. van der Rohe
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|