igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Memory liberation Python...


From: Tamas Nepusz
Subject: Re: [igraph] Memory liberation Python...
Date: Mon, 22 Sep 2008 16:13:50 +0100

But every time the subgraph method is called, memory is allocated for de
object and it's never liberated, even doing explicit del.
Hi Sergio,

Thanks for reporting that; however, I would need some further information:

- how large is your graph? (how many nodes, edges and communities are there) - why are you sure that the memory that is taken up by the subgraph you created is never returned to Python?

There's some kind of memory leak debugging built into igraph; if you built the Python interface from source, you can enable that by recompiling as follows:

CFLAGS=-DRC_DEBUG python setup.py build && python setup.py install

(make sure you delete the old build directory before you rebuild). When you compile the Python interface with -DRC_DEBUG, it will print every igraph object allocation and deallocation into stderr. I created a small test script as follows:

#!/usr/bin/env python
from igraph import *
import os

g = Graph.GRG(100, 0.2)
cl = g.community_fastgreedy()
for comm in xrange(len(cl)):
    sg = g.subgraph(cl[comm])
    fig = Plot(bbox=(1024,768))
    fig.add(sg, layout="kk", margin=(50,50,50,50))
    fig.save("dummy.png")
    os.unlink("dummy.png")
    del fig
    del sg

What I receive on stderr (filtered only to Graph objects) is:

[ alloc ] Graph @ 0x4f3140
[ alloc ] Graph @ 0x4f31c8
[dealloc] Graph @ 0x4f31c8
[ alloc ] Graph @ 0x4f31c8
[dealloc] Graph @ 0x4f31c8
[ alloc ] Graph @ 0x4f31c8
[dealloc] Graph @ 0x4f31c8
[ alloc ] Graph @ 0x4f31c8
[dealloc] Graph @ 0x4f31c8
[ alloc ] Graph @ 0x4f31c8
[dealloc] Graph @ 0x4f31c8
[dealloc] Graph @ 0x4f3140

The first and last line is for the graph itself, the other alloc- dealloc pairs are the subgraphs; so it looks like the objects are properly constructed and released (although there might be something weird going on in Python). Can you please post your output to me (not to the mailing list) if the problem still persists? Alternatively, if you can't recompile igraph, send me an example program and a graph that reproduces the error and I'll try to investigate it.

--
Tamas





reply via email to

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