aspose file tools
The moose likes Java in General and the fly likes Infinite loop or deadlock in finalize() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Infinite loop or deadlock in finalize()" Watch "Infinite loop or deadlock in finalize()" New topic
Author

Infinite loop or deadlock in finalize()

Victor Ho
Ranch Hand

Joined: Sep 05, 2003
Posts: 74
I am curious what would happen when you have an infinite loop or deadlock in finalize().

My guess is that the daemon GC thread will get hung up and as time goes on, heap space runs out which leads to OutOfMemory exception.

Any thoughts or more accurate knowledge on this?

Thanks
Victor
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
Why not try it yourself...



James Carman, President<br />Carman Consulting, Inc.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24054
    
  13

I debugged one of these, quite a few years ago. It was a CORBA program (on OrbixWeb) and somebody indirectly made a network call in finalize(). This led to a deadlock, and a messy debugging problem in a server process. We eventually had a rule that you couldn't write finalize() in any class on that project.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Infinite loop or deadlock in finalize()
 
Similar Threads
Confusing Output
finalize method
WA #1.....word association
Skip finally block
Thread example, dont know why is it a deadlock condition