Persisted object when closing MPart ? [message #1730528] |
Tue, 26 April 2016 13:56 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 #1731575 is a reply to message #1730547] |
Sat, 07 May 2016 04:06 |
Eclipse User |
|
|
|
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!
|
|
|
|
Powered by
FUDForum. Page generated in 0.04027 seconds