CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2009
    Posts
    20

    Finalize method()

    can u please give me any code that can clearly describe the use of finalize()....

  2. #2
    Join Date
    May 2009
    Location
    Lincs, UK
    Posts
    298

    Re: Finalize method()


  3. #3
    Join Date
    Jul 2005
    Location
    Currently in Mexico City
    Posts
    568

    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!

  4. #4
    Join Date
    May 2009
    Posts
    2,413

    Re: Finalize method()

    Quote Originally Posted by arpit2309 View Post
    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

  5. #5
    Join Date
    Apr 2007
    Posts
    425

    Re: Finalize method()

    Quote Originally Posted by nuzzle View Post
    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
    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!

  6. #6
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Finalize method()

    Quote Originally Posted by Deliverance View Post
    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 &#91;CODE]...your code here...&#91;/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
  •  





Click Here to Expand Forum to Full Width

Featured