Help with memory leaks

I am getting a warning of memory leaks in my plugin when I exit IntelliJ:

      • The following objects were not disposed:

      • com.intellij.openapi.graph.impl.builder.GraphBuilderImpl@1b7dd7 of class class com.intellij.openapi.graph.impl.builder.GraphBuilderImpl


But I know that I am calling the dispose method on my GraphBuilder. Any suggestions that will prevent me from having to run it through a profiler?

2 comments

Hi, Shawn !

You have to register your graphBuilder(or any other Disposable objects) in
Disposer.

for instance,

public class MyGraphComponent extends JPanel implements Disposable {

private final GraphBuilder<MyNode, MyEdge> myBuilder;

public MyGraphComponent () {
....
myBuilder = GraphBuilderFactory.getInstance(project).createGraphBuilder(graph,
view, myDataModel, myPresentationModel);

// !!!!! register GraphBuilder
Disposer.register(this, myBuilder);

myBuilder.initialize();
}


Serega.


0

Please sign in to leave a comment.