Chris,

Thanks! I made ticket

http://trac.gispython.org/lab/ticket/181

And will make the fix asap. Cheers,
Sean

On Jan 3, 2009, at 4:08 PM, Chris Adams wrote:

> I fixed the problem, it deem seem to be a memory leak
>
> in rtree/wrapper.cc, in the PyListVisitor class, I changed the  
> visitData function to the following:
>
>     void visitData(const IData & d)
>     {
>         PyObject * ob = PyLong_FromLongLong(d.getIdentifier());
>         PyList_Append(ids, ob);
>         Py_DECREF(ob);
>     }
>
> after rebuilding this, I ran the test described in the previous  
> post, and the memory leak was fixed. I then tested my own  
> application as a correctness test, and although the running time  
> increased slightly, the output was correct.
>
> - Chris
>
> From: [email protected]
> To: [email protected]
> Date: Sat, 3 Jan 2009 16:51:19 -0400
> Subject: [Community] Possible Rtree 0.4.1 memory leak, Does  
> spatialindex do query caching?
>
> Running the following python script, which uses Rtree 0.4.1, which  
> uses spatialindex, after the index is built the repeated queries  
> cause the memory usage to increase by megabytes a second. This is  
> not a python garbage collection problem, you can see, the ref count  
> of zxy, and x (results) are both equal (2), which indicates one  
> reference for the variable, and one reference for the parameter to  
> the getrefcount function.
>
> from rtree import Rtree
> import sys
> def y(index):
>     zxy = [ 1, 2, 3, 4 ]
>     print "zyx: %d"%(sys.getrefcount(zxy))
>     x = index.intersection((0.25, 0.25, 0.75, 0.75))
>     print "x: %d"%(sys.getrefcount(x))
>     print "x: %d"%(sys.getrefcount(x))
>     del x[:]
>     del x
>
> index = Rtree()
> for i in range(0, 50000):
>     index.add(i, (0, 0, 1, 1))
> while 1:
>     y(index)
>
> Thanks,
>
> - Chris
> Share your holiday memories for free with Windows LiveT Photos. Get  
> started now.
> Win a trip with your 3 best buddies. Enter today.  
> _______________________________________________
> Community mailing list
> [email protected]
> http://lists.gispython.org/mailman/listinfo/community

_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community

Reply via email to