image memory release problem in palette [message #217661] |
Mon, 12 June 2006 03:05 |
Eclipse User |
|
|
|
Originally posted by: brandonchen.realtek.com.tw
I have a problem in realeasing the memory allocation in PaletteRoot. I
notice that if I add image to the palette, the memory wouldn't be relaesed
completely after the palette closes. I use the number of GDI to calculate
the usage of image.
For example, I run a simple program with only palette inside.
GDI = 1224 before opening the GEF file
GDI = 1508 after loading some images to the palette
GDI = 1330 close the GEF file, and the GDI doen't release completely even
after I dispose all the images.
It is just my assumption that the palette doesn't dispose the image resource
completely. Or maybe I didn't use the class approriately. How to avoid the
increasing number of GDI? Appreciated for any reply!
Following is the segment of adding images to the palette.
combined = new CombinedTemplateCreationEntry(
"text",
"",
"",
sx,
ImageDescriptor.createFromImage(image1),
ImageDescriptor.createFromImage(image2));
drawer.add(combined);
Sincerely,
Brandon
|
|
|
Re: image memory release problem in palette [message #218061 is a reply to message #217661] |
Mon, 19 June 2006 00:38 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
You are correct, the palette never frees its images. This is some bad code
that learned its resource management from an earlier version of
ActionContributionItem. The workbench has since introduced reference
counting for images and we should start using that utility (i.e. jface's
ResourceManager).
"Brandon" <brandonchen@realtek.com.tw> wrote in message
news:e6ilmi$kj$1@utils.eclipse.org...
>I have a problem in realeasing the memory allocation in PaletteRoot. I
> notice that if I add image to the palette, the memory wouldn't be relaesed
> completely after the palette closes. I use the number of GDI to calculate
> the usage of image.
>
> For example, I run a simple program with only palette inside.
> GDI = 1224 before opening the GEF file
> GDI = 1508 after loading some images to the palette
> GDI = 1330 close the GEF file, and the GDI doen't release completely
> even
> after I dispose all the images.
>
> It is just my assumption that the palette doesn't dispose the image
> resource
> completely. Or maybe I didn't use the class approriately. How to avoid the
> increasing number of GDI? Appreciated for any reply!
>
> Following is the segment of adding images to the palette.
> combined = new CombinedTemplateCreationEntry(
> "text",
> "",
> "",
> sx,
> ImageDescriptor.createFromImage(image1),
> ImageDescriptor.createFromImage(image2));
>
> drawer.add(combined);
>
>
> Sincerely,
>
> Brandon
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.24869 seconds