Should I dispose image object while no longer required? [message #467809] |
Tue, 07 February 2006 03:39 |
Eclipse User |
|
|
|
HI,
In the tutorial, it says that we should explicitly dispose the Image object.
Here comes the question:
The memory used in my program keep growing up. It's apparent that I don't
dispose some objects that required dispose manually.
In the case below, would the garbage collector cleans the image object after
MyClass object is no longer needed?
If not, how can I dispose the image object? If in C++, I can put codes in
the destructor(). How about in SWT?
Thanks!!
public class MyClass {
Image image = new Image(null, "c://a.bmp"); //?? how to clean the
memory for image object
public Image getImage(){
return this.image;
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.16563 seconds