Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Memory Leak
Memory Leak [message #240833] Sun, 20 January 2008 17:32 Go to next message
Eclipse UserFriend
Originally posted by: vb.prismtech.com

This is a multi-part message in MIME format.

------=_NextPart_000_001C_01C85B60.8FA5B990
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,
I am using the class CombinedTemplateCreationEntry for adding items to =
the Palette.
I pass this class an ImageDescriptor to display the icon in the palette, =
which is resulting in a memory leak.


Is there a way to get a handle to the image created to dispose it ?

Here is a code snippet:

Image img =3D new Image(....);

ImageDescriptor desc =3D ImageDescriptor.createFromImage(img);

CombinedTemplateCreationEntry entry =3D new =
CombinedTemplateCreationEntry( p1,p2, obj, fact, desc,desc);

Even if I dispose "img" when the editor is closed, I still see a memory =
leak.=20

Adding the descriptor to an ImageRegistry and calling dispose on the =
registry doesnt help either.

Thanks,

Vikram
------=_NextPart_000_001C_01C85B60.8FA5B990
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.3243" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I am using the class =
CombinedTemplateCreationEntry=20
for adding items to the Palette.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I pass this class an ImageDescriptor to =
display the=20
icon in the palette, which is resulting in a memory leak.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Is there a way to&nbsp;get a handle to =
the image=20
created to dispose it ?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Here is a code snippet:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>
<P align=3Dleft><FONT face=3DArial size=3D2>Image img =3D new =
Image(....);</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2>ImageDescriptor desc =3D=20
ImageDescriptor.createFromImage(img);</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D2>CombinedTemplateCreationEntry entry =3D new=20
CombinedTemplateCreationEntry( p1,p2, obj, fact, desc,desc);</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2>Even if I dispose "img" when =
the editor is=20
closed, I still see a memory leak. </FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2>Adding the descriptor to an =
ImageRegistry=20
and calling dispose on the registry doesnt help either.</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2>Thanks,</FONT></P></DIV>
<DIV><FONT face=3DArial size=3D2>Vikram</FONT></DIV></BODY></HTML>

------=_NextPart_000_001C_01C85B60.8FA5B990--
Re: Memory Leak [message #240840 is a reply to message #240833] Mon, 21 January 2008 08:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alexjaquet.gmail.com

Have you tryed to declare your Image as final
Re: Memory Leak [message #240845 is a reply to message #240833] Mon, 21 January 2008 10:13 Go to previous messageGo to next message
Manuel Selva is currently offline Manuel SelvaFriend
Messages: 189
Registered: July 2009
Location: Grenoble, France
Senior Member
Hi,

In fact when you need to provide an ImageDescriptor only, you don't need
to create a new Image.

Just ask your AbstractUIPlugin for an ImageDescriptor.

AbstractUIPlugin.imageDescriptorFromPlugin(String pluginId,String
imageFilePath).

When you speak about memory leak, what leak are you speaking about :

- leak about OS window manager and number of image (how do you see it ?
With Sleak ?)

- leak at JVM level (how do you see it ?
http://manuelselva.wordpress.com/2008/01/16/profile-your-ecl ipse-plugins-with-sap-memory-analyzer/)

Hope this help

Manuel
http://manuelselva.wordpress.com/


Re: Memory Leak [message #240852 is a reply to message #240845] Mon, 21 January 2008 14:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vb.prismtech.com

Hi,
The image is created dynamically from another image, not from a file.
I have tried to put this in a descriptor as well, but that doesnt help.

I am using the Sleak tool which shows the leak.

Thanks,
Vikram



"Manuel Selva" <manuel.selva@st.com> wrote in message
news:01c3ce7322ecb06d734da1bb517d954d$1@www.eclipse.org...
> Hi,
>
> In fact when you need to provide an ImageDescriptor only, you don't need
> to create a new Image.
>
> Just ask your AbstractUIPlugin for an ImageDescriptor.
>
> AbstractUIPlugin.imageDescriptorFromPlugin(String pluginId,String
> imageFilePath).
>
> When you speak about memory leak, what leak are you speaking about :
>
> - leak about OS window manager and number of image (how do you see it ?
> With Sleak ?)
>
> - leak at JVM level (how do you see it ?
> http://manuelselva.wordpress.com/2008/01/16/profile-your-ecl ipse-plugins-with-sap-memory-analyzer/)
>
> Hope this help
>
> Manuel
> http://manuelselva.wordpress.com/
>
Re: Memory Leak [message #240857 is a reply to message #240840] Mon, 21 January 2008 14:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vb.prismtech.com

I will try this out.
Thanks

"Alexandre Jaquet" <alexjaquet@gmail.com> wrote in message
news:fn1mmo$j2p$1@build.eclipse.org...
> Have you tryed to declare your Image as final
Re: Memory Leak [message #240872 is a reply to message #240852] Tue, 22 January 2008 07:38 Go to previous messageGo to next message
Manuel Selva is currently offline Manuel SelvaFriend
Messages: 189
Registered: July 2009
Location: Grenoble, France
Senior Member
Hi,

Calling the dispose() method on img MUST release the underlying OS
resource. Are you sure to dispose all the created images ? If yes you, you
should open a bugzilla entry with a standalone snippet showing the problem.

Manu
http://manuelselva.wordpress.com/


Re: Memory Leak [message #240887 is a reply to message #240872] Tue, 22 January 2008 14:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vb.prismtech.com

I think this covers it:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=154145


"Manuel Selva" <manuel.selva@st.com> wrote in message
news:2c2bac5f7f9c05fa885e89234ae25ce2$1@www.eclipse.org...
> Hi,
>
> Calling the dispose() method on img MUST release the underlying OS
> resource. Are you sure to dispose all the created images ? If yes you, you
> should open a bugzilla entry with a standalone snippet showing the
> problem.
>
> Manu
> http://manuelselva.wordpress.com/
>
Re: Memory Leak [message #241346 is a reply to message #240833] Thu, 07 February 2008 14:53 Go to previous message
Eclipse UserFriend
Originally posted by: none.ibm.com

This is a multi-part message in MIME format.

------=_NextPart_000_00A2_01C8696F.3E449EF0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

This is a bug in GEF. ResourceManager support was added to =
EditPartViewer in 3.3. The PaletteViewer should not have its own =
ImageCache any more, it should use the ResourceManager instead. A =
bugzilla is probably open on this already. This permanent leak of =
Images was borrowed from ActionContributionItem way back when, but when =
it cleaned up its act, GEF didn't follow suit.

Are you interested in providing a patch to =
PaletteEditPart#setImageDescriptor(...)?

"Vikram" <vb@prismtech.com> wrote in message =
news:fn00k2$ta9$1@build.eclipse.org...
Hi,
I am using the class CombinedTemplateCreationEntry for adding items to =
the Palette.
I pass this class an ImageDescriptor to display the icon in the =
palette, which is resulting in a memory leak.


Is there a way to get a handle to the image created to dispose it ?

Here is a code snippet:

Image img =3D new Image(....);

ImageDescriptor desc =3D ImageDescriptor.createFromImage(img);

CombinedTemplateCreationEntry entry =3D new =
CombinedTemplateCreationEntry( p1,p2, obj, fact, desc,desc);

Even if I dispose "img" when the editor is closed, I still see a =
memory leak.=20

Adding the descriptor to an ImageRegistry and calling dispose on the =
registry doesnt help either.

Thanks,

Vikram
------=_NextPart_000_00A2_01C8696F.3E449EF0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.3243" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>This is a bug in GEF.&nbsp; =
ResourceManager support=20
was added to EditPartViewer in 3.3.&nbsp; The PaletteViewer should not =
have its=20
own ImageCache any more, it should use the ResourceManager =
instead.&nbsp; A=20
bugzilla is probably open on this already.&nbsp; This permanent leak of =
Images=20
was borrowed from ActionContributionItem way back when, but when it =
cleaned up=20
its act, GEF didn't follow suit.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Are you interested in providing a patch =
to=20
PaletteEditPart#setImageDescriptor(...)?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Vikram" &lt;<A =
href=3D"mailto:vb@prismtech.com">vb@prismtech.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:fn00k2$ta9$1@build.eclipse.org">news:fn00k2$ta9$1@build.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I am using the class=20
CombinedTemplateCreationEntry for adding items to the =
Palette.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I pass this class an ImageDescriptor =
to display=20
the icon in the palette, which is resulting in a memory =
leak.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Is there a way to&nbsp;get a handle =
to the image=20
created to dispose it ?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Here is a code snippet:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>
<P align=3Dleft><FONT face=3DArial size=3D2>Image img =3D new =
Image(....);</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2>ImageDescriptor desc =3D=20
ImageDescriptor.createFromImage(img);</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D2>CombinedTemplateCreationEntry entry =3D=20
new CombinedTemplateCreationEntry( p1,p2, obj, fact, =
desc,desc);</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2>Even if I dispose "img" =
when the editor=20
is closed, I still see a memory leak. </FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2>Adding the descriptor to =
an=20
ImageRegistry and calling dispose on the registry doesnt help=20
either.</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2>Thanks,</FONT></P></DIV>
<DIV><FONT face=3DArial =
size=3D2>Vikram</FONT></DIV></BLOCKQUOTE></BODY></HTML >

------=_NextPart_000_00A2_01C8696F.3E449EF0--
Previous Topic:Add SWT button to a GEF diagram
Next Topic:How to use the transateToRelative methods correctly?
Goto Forum:
  


Current Time: Fri Apr 26 09:10:21 GMT 2024

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

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

Back to the top