[Community] Possible Rtree 0.4.1 memory leak, Does spatialindex do query caching?
Chris Adams
lithium_eadgbe at hotmail.com
Sat Jan 3 22:51:19 EET 2009
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
_________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gispython.org/pipermail/community/attachments/20090103/2e19ffdc/attachment.htm>
More information about the Community
mailing list