Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312567

Summary: Snapshots not released after using Search Queries context menu and closing them
Product: [Tools] MAT Reporter: Krum Tsvetkov <krum.tsvetkov>
Component: CoreAssignee: Project Inbox <mat.core-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: andrew_johnson
Version: 1.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Reference chain keeping the SnapshotImpl instance
none
Path through QueryContextMenu$QueryAction none

Description Krum Tsvetkov CLA 2010-05-12 05:55:58 EDT
I just noticed that if I work with a snapshot and use the context menu "search queries" , then after I close the snapshot editor the snapshot is still kept in memory. I'll attach some reference chains keeping the snapshots.
Comment 1 Krum Tsvetkov CLA 2010-05-12 06:00:09 EDT
Created attachment 168108 [details]
Reference chain keeping the SnapshotImpl instance
Comment 2 Krum Tsvetkov CLA 2010-05-12 06:32:43 EDT
Created attachment 168112 [details]
Path through QueryContextMenu$QueryAction

I noticed another similar effect - snapshotImpl being held, probably with a different cause. Still the context menu is involved, so I paste it to the same bug.
Comment 3 Andrew Johnson CLA 2010-05-12 10:09:36 EDT
We may need to close the QueryContextHelp and dispose the styled text and clear the fields.
Comment 4 Andrew Johnson CLA 2010-05-12 11:10:12 EDT
Here's the path I fixed with the QueryContextHelp change:

Class Name                                                                                 | Shallow Heap | Retained Heap 
--------------------------------------------------------------------------------------------------------------------------
org.eclipse.mat.parser.internal.SnapshotImpl @ 0x1105370                                   |           72 |     5,879,992 
'- org.eclipse.mat.internal.snapshot.SnapshotQueryContext @ 0x1abef80                      |           16 |     5,880,008 
   '- org.eclipse.mat.ui.internal.browser.QueryContextHelp @ 0x1adde70                     |          152 |     5,881,344 
      '- org.eclipse.jface.window.Window$FontChangeListener @ 0x1ade038                    |           16 |     5,881,360 
         '- [4] java.lang.Object[6] @ 0x1b00d30                                            |           40 |     5,884,104 
            '- org.eclipse.core.runtime.ListenerList @ 0xbf7730                            |           24 |     5,884,128 
               '- org.eclipse.jface.resource.FontRegistry @ 0xbae400                       |           32 |     5,885,728 
                  |- class org.eclipse.jface.resource.JFaceResources @ 0xbaacb8            |           64 |           536 
                  |  '- org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader @ 0xb5f4f8|           96 |        26,616 
--------------------------------------------------------------------------------------------------------------------------
Comment 5 Andrew Johnson CLA 2010-05-12 11:40:42 EDT
I've also put a fix in QueryBrowserPopup to close the help.

http://www.eclipse.org/articles/swt-design-2/swt-design-2.html
Comment 6 Andrew Johnson CLA 2010-05-12 16:53:20 EDT
Is this now fixed?
Comment 7 Krum Tsvetkov CLA 2010-05-14 02:34:47 EDT
I did some more tests and couldn't reproduce the problem any longer. Andrew, thanks for the very fast fixes!