[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] shortest paths and ram

From: Tamas Nepusz
Subject: Re: [igraph] shortest paths and ram
Date: Wed, 10 Jun 2009 16:15:34 +0100
User-agent: Mutt/1.5.17 (2007-11-01)

Hi Davide,

> another (stupid? ;-) ) question: i'm trying to find the average
> distance for a weighted strongly connected graph. I think that i
> should use Graph.shortest_paths() looping over each node, but step
> after step the ram consuption increases.
Python's garbage collection mechanisms might cause that, but I'm not
100% sure. Currently I'm running your code in Valgrind to check for
possible memory leaks in the igraph core. In the meanwhile, you might
try calling Python's garbage collection mechanism explicitly using
gc.collect(). What I did is: I called g.shortest_paths_dijkstra() 10
times on your graph with a single vertex, noted that the memory usage
went up (cat /proc/<pid>/status | grep VmSize), then called
gc.collect(), called g.shortest_paths_dijkstra() 10 times again and
noted that the memory usage stayed the same.

Note that gc.collect() will never release memory back to the OS, this is
because Python's memory manager uses an internal pool and it never gives
back anything to the OS in the hope that it might be useful later.
That's why the memory usage didn't decrease for me after calling


Attachment: pgpbNCw2nQj_P.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]