CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Deploying Windows Server 2008 with System Center
  • Remote Desktop Protocol Performance Improvements in Windows Server 2008 R2 and Windows 7
  • The Microsoft Dynamics CRM Security Model
  • SQL Server Modeling Services with Microsoft Visual Studio 2010 Beta 2

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Java Programming > Java Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Java Programming Ask your Java programming question and help out others with theirs.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old September 8th, 2009, 01:35 PM
    arpit2309 arpit2309 is offline
    Junior Member
     
    Join Date: Sep 2009
    Posts: 16
    arpit2309 is an unknown quantity at this point (<10)
    Finalize method()

    can u please give me any code that can clearly describe the use of finalize()....
    Reply With Quote
      #2    
    Old September 8th, 2009, 04:37 PM
    jcaccia jcaccia is offline
    Member
     
    Join Date: May 2009
    Location: Surrey, UK
    Posts: 163
    jcaccia is an unknown quantity at this point (<10)
    Re: Finalize method()

    finalize()
    Reply With Quote
      #3    
    Old September 9th, 2009, 04:32 PM
    Xeel's Avatar
    Xeel Xeel is offline
    Member
     
    Join Date: Jul 2005
    Location: Currently in Mexico City
    Posts: 465
    Xeel has a spectacular aura about (150+) Xeel has a spectacular aura about (150+)
    Re: Finalize method()



    sorry, couldn't stay quiet...
    __________________
    Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?

    willCodeForFood("PHP,Java,C#,C++,Assembler,XML,VBS,XHTML,CSS,JavaScript,SQL"); //always looking for job opportunities in AU/NZ/US/CA/Europe :P
    USE [code] TAGS! Read this FAQ if you are new here. If this post was helpful, please rate it!
    Reply With Quote
      #4    
    Old September 10th, 2009, 02:50 AM
    nuzzle nuzzle is offline
    Member +
     
    Join Date: May 2009
    Posts: 738
    nuzzle has a spectacular aura about (150+) nuzzle has a spectacular aura about (150+)
    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
    Reply With Quote
      #5    
    Old September 10th, 2009, 09:44 AM
    Deliverance Deliverance is offline
    Member
     
    Join Date: Apr 2007
    Posts: 371
    Deliverance is on a distinguished road (40+)
    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!
    Reply With Quote
      #6    
    Old September 10th, 2009, 10:00 AM
    dlorde dlorde is offline
    Elite Member
    Power Poster
     
    Join Date: Aug 1999
    Location: UK
    Posts: 9,372
    dlorde is a glorious beacon of light (400+) dlorde is a glorious beacon of light (400+) dlorde is a glorious beacon of light (400+) dlorde is a glorious beacon of light (400+) dlorde is a glorious beacon of light (400+) dlorde is a glorious beacon of light (400+)
    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 [CODE]...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Java Programming > Java Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 03:37 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.