Possible memory leak on Dynamic Range Filter
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Gephi |
Fix Released
|
High
|
Mathieu Bastian |
Bug Description
This problem appears when applying many times the Dynamic Range Filter in a large dynamic graph.
I'm using the Toolkit built from the 0.8 release sources, but this leak could affect the desktop application when using the Dynamic Range Filter.
Attached, a zip containing a gexf file with a large dynamic graph, and a java file that applies a dynamic range filter many times in succession, in order to take snapshots of the graph at different ranges.
The application starts with low memory usage after loading the graph, but when the filter is applied some times, the memory usage starts to increase.
It seems that the EventManager thread does not bear the amount of events generated by the filtering (the rate of produced events is much larger than the rate of consumed events).
Changed in gephi: | |
status: | New → Confirmed |
milestone: | none → 0.8alpha |
assignee: | nobody → Mathieu Bastian (mathieu.bastian) |
importance: | Undecided → High |
Changed in gephi: | |
status: | Confirmed → Fix Committed |
Changed in gephi: | |
status: | Fix Committed → Fix Released |
I have some ideas on how to face this problem.
First off, I would like to know if there's any possibility of creating new views without creating new node instances, but reusing the existing ones. This could reduce the amount of memory usage.
The possible solutions I have in mind are:
1. Choosing different strategies when applying a filter:
Actually, it seems that the strategy used when applying a filter is by duplicating the entire view and filter out the graph objects that do not pass the filter one by one. In a situation where I have a graph with thousands of nodes and the resulting filtered view has few nodes, the best strategy is by creating an empty view and adding the nodes that pass the filter. That would be faster and produce less events.
2. Fortunately, when Mathiew implemented the EventManager, he implemented it in such a way that the events could be grouped by type before being consumed. The problem is that when applying a filter, nodes are removed one by one from the view, and for each REMOVE_NODES event fired, the corresponding REMOVE_EDGES events are also fired, and there's no possibility of grouping the alternating event types in this way. A better strategy would be firing all REMOVE_EDGES events before firing the REMOVE_NODES events, in order to give to the EventManager the possibility to group them and creating only two event groups when removing a list of nodes.