Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Persisted object when closing MPart ?(What happen to objects created inside an MPart when it is closed)
Persisted object when closing MPart ? [message #1730528] Tue, 26 April 2016 13:56 Go to next message
Eclipse UserFriend
Hello,

I have a big application which display biological datasets (i.e. bacterial genomes). When one of my Mpart is created it creates an object named Track which take 2Go of RAM memory.
When the MPart is removed and hides, the object Track still persist and the memory is not liberated by the garbage collector. Even if I specifically mention Track = null; It never triggers the garbage collection.

Any idea why my objects persist in memory like that ?

Here a summary of my MPart:
public class GenomeTranscriptomeView {
	private TracksComposite tracksComposite;
	private Track track;
	private ArrayList<String> bioCondNames;
	private Genome genome;
	
	@Inject
	EPartService partService;
	
	@Inject
	MPart part;
	
	@ Inject
	@ Named (IServiceConstants.ACTIVE_SHELL)
	private Shell shell;
	
	@Inject
	public GenomeTranscriptomeView(){
	}

	@PostConstruct
	public void createPartControl(Composite parent) {
                      /*
                      /   Create the MPart and inititate the object Track = 2Go in              memory
                      */
        }

        @PreDestroy
	public void preDestroy(){
		track = null;
		tracksComposite.dispose();
		partService.hidePart(part, true);
        }
Re: Persisted object when closing MPart ? [message #1730545 is a reply to message #1730528] Tue, 26 April 2016 15:11 Go to previous messageGo to next message
Eclipse UserFriend
I think you'll have to do some hunting. Put a breakpoint in your preDestroy(). In the Variables view, right-click on your `track` object and select `All References...`. You'll have a reference to your `GenomeTranscriptomeView` class, and you should find any other references too.
Re: Persisted object when closing MPart ? [message #1730547 is a reply to message #1730545] Tue, 26 April 2016 15:12 Go to previous messageGo to next message
Eclipse UserFriend
The Eclipse Memory Analysis Toolkit provides some more sophisticated tools for introspecting.
Re: Persisted object when closing MPart ? [message #1731575 is a reply to message #1730547] Sat, 07 May 2016 04:06 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your answer.
I m finally back into my code after some holiday.
And the use of the Memory Analyzer you mention really helped.

In fact my object are destroyed, and I don t even need to use the PreDestroy annotation and destroy them myself. What I was seeing is the fact that even if the Heap Dump is back to 200mo, after a peak to 2Go. The JVM will stay at 2Go. Java has reserve some space for the JVM and keeps it.
Anyway, my code was in fact stupid in someway because I was creating huge objects full of zero values. I use now a ''streaming'' method to load my data and the size of the JVM is reduce by more than half.

Thanks again for the suggestion!
Re: Persisted object when closing MPart ? [message #1740385 is a reply to message #1731575] Fri, 12 August 2016 13:26 Go to previous message
Eclipse UserFriend
Ok, I finally update to RAP 3,1 and the bug is fixed.
Thank you!!!

However now I have a related problem but it is linked to UISession closing: Objects are not destroyed!
I created a new thread for that question:
e4 RAP - Object are never destroyed when closing UISession
Previous Topic:Get position or triggering mouse event of MPopupMenu
Next Topic:Styling tabs of MParts
Goto Forum:
  


Current Time: Sat Apr 20 03:29:51 GMT 2024

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

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

Back to the top