Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Dispose question
Dispose question [message #826056] Wed, 21 March 2012 15:47 Go to next message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 305
Registered: July 2009
Senior Member

Hi,

When the JVM terminates, are all operating system handles (font, images) automatically released, even when there is no explicit dispose? Or are the non-disposed operating system handles in use until the next OS restart?

Regards,

Wim

[Updated on: Wed, 21 March 2012 15:47]

Report message to a moderator

Re: Dispose question [message #826223 is a reply to message #826056] Wed, 21 March 2012 20:30 Go to previous messageGo to next message
Catalin Gerea is currently offline Catalin GereaFriend
Messages: 89
Registered: July 2009
Location: Bucharest, Romania
Member

Hello Jim

The good sense would tell yes (otherwise the OS has a resource management problem). A stack overflow question http://stackoverflow.com/questions/9427890/are-native-screen-resources-automatically-released-when-the-jvm-exits tells also yes.
Another question http://stackoverflow.com/questions/3809808/jvm-abnormal-exit-cleanup-of-system-resources is more targeted to the resources to be released.

Can I ask what was the problem/issue that triggered your question?

On Windows we have used GDI View http://www.nirsoft.net/utils/gdi_handles.html to observe the GDI resources allocated to a Java application. For other OS's I do not know similar tools and I would appreciate if somebody will point me to such tools.

[Later Edit] http://www.eclipse.org/articles/swt-design-2/swt-design-2.html --> Quote:
The operating system frees all of a program's resources when the program exits.


Time is what you make of it.

[Updated on: Wed, 21 March 2012 20:45]

Report message to a moderator

Re: Dispose question [message #826788 is a reply to message #826223] Thu, 22 March 2012 14:03 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 305
Registered: July 2009
Senior Member

Hello Catalin,

Thanks! I had the feeling that closing the process would also reclaim all resources but was never able to find the written rule.

Quote:
The operating system frees all of a program's resources when the program exits. Why not just rely on this? Operating system resources are not infinite. If your program doesn't free up resources as they are no longer needed, it can run out of resources. It can also cause other programs to run out of resources. So waiting until the program exits to free up resources is generally a bad idea. Leak tools exist to help detect resource leaks. You can use the Sleak tool to look for leaks in your SWT application.


from: http://www.eclipse.org/articles/swt-design-2/swt-design-2.html
Previous Topic:segmentation fault indigo SR2 with glassfish 3.1.2 plugin
Next Topic:Scrollbar inside a tabItem
Goto Forum:
  


Current Time: Tue Dec 23 03:43:37 GMT 2014

Powered by FUDForum. Page generated in 0.10178 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software