Difference between revisions of "FAQ Why do I have to dispose of colors, fonts, and images?"
|Line 4:||Line 4:|
Latest revision as of 12:58, 30 May 2013
This question was asked so often that the SWT team wrote an article to explain why. The Eclipse online article “Managing Operating System Resources”, by Carolyn McLeod and Steve Northover describes SWT’s philosophy on resource management and defends its reasons for not relying on the Java garbage collector for disposing of unused resources. The philosophy, in short, is this: If you create it, you dispose of it. The capsule summary of the reasoning is that the specification for Java finalization is too weak to reliably support management of operating system resources. This is also why database connections, sockets, file handles, and other heavyweight resources are not handled by the Java garbage collector. If you are still not convinced, read the article.
This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.