igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Python-igraph: Possible memory leak in GraphBase.get_all_sh


From: Fahad Khalid
Subject: Re: [igraph] Python-igraph: Possible memory leak in GraphBase.get_all_shortest_paths()
Date: Tue, 8 Dec 2015 10:04:34 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

Hi Tamas,

Thanks for looking into this issue.

The code you sent works just fine on my machine as well. In fact, with smaller graphs, I never had any problems in my code either. Please find below a slight update to your code, which makes it possible to work with a large graph (n=2000 in this case) in the way I'm using get_all_shortest_paths() in my code.

#!/usr/bin/env python

from psutil import Process
from igraph import Graph, OUT

import gc

self = Process()

g = Graph.GRG(2000, 0.1)

vcount = g.vcount()

for i in xrange(100):
    sps = g.get_all_shortest_paths(0, i, mode=OUT)
   
    del sps
   
    gc.collect()
   
    mem_info = self.memory_info()
   
    print i, mem_info.rss, mem_info.vms

We can get a sense of the behavior from the following plot:


This is just part of the picture; in several cases the spikes are even higher than those we see here.

Is this the expected memory consumption behavior? Perhaps I'm not using the function in the way it was intended to be used?

The bottom line is that this version of the code requires several GB of free RAM on the machine, which makes it impractical for use in my code. I'd appreciate your suggestion on how to proceed on this issue.

Thanks again!

Regards,
/Fahad


On 12/07/2015 10:23 PM, Tamas Nepusz wrote:
Hi,

I have tested it now on a Mac with the following code:

#!/usr/bin/env python

from psutil import Process
from igraph import Graph

import gc

self = Process()
g = Graph.GRG(400, 0.1)
for i in xrange(100):
    sps = g.get_all_shortest_paths(0)
    del sps
    gc.collect()
    mem_info = self.memory_info()
    print i, mem_info.rss, mem_info.vms

The memory usage seems pretty stable to me; these are the results
(iteration count, resident set size, virtual memory size):

0 23523328 2532331520
1 24576000 2535403520
2 24584192 2535411712
3 23535616 2534363136
4 24584192 2535411712
5 25657344 2536476672
6 23560192 2534379520
7 23564288 2534379520
8 24788992 2534354944
9 25837568 2535403520
10 23744512 2533306368
11 24698880 2533339136
12 23773184 2533339136
13 24817664 2534387712
14 26710016 2535436288
15 23773184 2533339136
16 24825856 2534387712
17 24825856 2534387712
18 24821760 2534387712
19 23773184 2533339136
20 24821760 2534387712

So I don't think there's a leak there, at least not on Mac OS X. If
you can send me a small, self-contained program, equipped with a
similar instrumentation (see the code above) that seems to leak on
your machine, that would be great. (Note that you'll need to install
psutil from pip).

All the best,
T.


On Mon, Dec 7, 2015 at 9:29 AM,  <address@hidden> wrote:
Hi,

I am developing a network analysis tool for evolutionary biology, which uses
python-igraph. It appears that repeatedly calling get_all_shortest_paths()
on the graph results in the consumption of available memory quite quickly. I
have narrowed the memory leak down to get_all_shortest_paths() by using a
memory profiler.

I was using python-igraph-0.6 earlier and then upgraded to
python-igraph-0.7.1.post6. The upgrade did not solve the problem. The OS is
Ubuntu 14.04 LTS, with python 2.7.6.

Has someone else come across the same issue?

Regards,
/Fahad

_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help

_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help


reply via email to

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