Home Wiki Blog Forum GEXF.net

Gephi forums

Community support

Projectcontroller and GraphModel in loop

Automated tasks on server

Projectcontroller and GraphModel in loop

Postby cptk-user » 18 Nov 2013 20:09

Consider the following code which, in a multi-threaded fashion, reads a file from disk, processes its content and stores the result in a set. Some of the calculations in MyObject involves creating a graph using the toolkit:
Code: Select all
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
// Need the model for the graph and the attributes that will store the values.
GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();

for(File f : dir.listFiles()){
            final String filepath = f.getAbsoluteFile().toString();
            Callable<DocWrapper> future = new MyObject(filepath, pc, graphModel);
            System.out.println("Finished " + service.getCompletedTaskCount()+"/"+total);

This method /drains/ my memory extremely fast. Removing the ProjectController and GraphModel from the call to MyObject (and removing them correspondingly in the MyObejct itself) solves the problem, but that is not a solution. I have systematically gone through and tested the MyObject code and the result is the same: Only with the projectcontroller and graphmodel is the memory problem an issue. If I were to take a stab at it, I would say its the pass by value problem that is causing it to destroy my memory, but am I wrong?

I should say i have written a non-multithreaded version of MyObject and the problem is identical.

Hope you can shed some light on it, and thanks for a great toolkit.
Posts: 1
Joined: 18 Nov 2013 20:01

Return to Toolkit

Who is online

Users browsing this forum: No registered users and 0 guests