Comments (2)
import rtree
import random
import time
def createDefaultIndex():
idx = rtree.index.Rtree(u"defaultIndex")
# make boxes....
boxes = []
for boxIndex in range(0,100):
xmin = random.random()
ymin = random.random()
xmax = xmin + random.random()
ymax = ymin + random.random()
boxes.append((xmin,ymin,xmax,ymax))
for boxIndex, box in enumerate(boxes):
pickledObject = "makethisbig " * 100000
idx.insert(boxIndex, box, obj=pickledObject)
del idx
def readIndexDefault():
indexPath = u"defaultIndex"
#idx = rtree.index.Rtree(indexPath)
idx = rtree.index.Index(indexPath)
boundingCoords = [0,0,60,60]
print "Consuming Index"
startTime = time.time()
#hits = list(idx.intersection(boundingCoords, objects=True)) # memory leak
#hits = list(idx.intersection(boundingCoords, objects="raw")) # no memory leak
hits = list(idx.intersection(boundingCoords, objects=False)) # no memory leak
#hits = list(idx.intersection(boundingCoords))
endTime = time.time()
print "Consuming time: ", endTime - startTime
print "Hits: ", len(hits)
time.sleep(10)
print "Done Consuming - erasing memory"
idx = None
hits=None
for counter in range(0,10):
time.sleep(1)
# what we have learned:
# if objects == true, we have memory leak. hits, idx each have
# the size of the dat file and those are released. however, there is
# a 3rd memory allocation for the size of the dat file, mysterious, that
# is not released.
# if object != true, then there is no memory leak.
# if object == "raw" then no memory leak
if name == "main":
createDefaultIndex()
readIndexDefault()
from rtree.
Can you please test this and reopen if it is still an issue?
from rtree.
Related Issues (20)
- Comparison in test_index.py::IndexSerialization::test_interleaving sometimes fails HOT 1
- Mismatch between package and New M1 apple silicon HOT 1
- rtree import still leads to dlsym Attribute Error and crashes geopandas HOT 1
- Python 3.10 wheels HOT 2
- rtree fails to import HOT 1
- ArgumentError: expected LP_LP_c_long instance instead of pointer to LP_c_long HOT 8
- typing_extensions now required HOT 1
- Using rtree in Cygwin HOT 1
- import rtree leads to `OSError: Could not load libspatialindex_c library` on aarch64 HOT 6
- Please release a new version with the type hints support HOT 1
- Index is checking write access despite assuming read-only access HOT 3
- why .dat file modified after intersection query?
- Nearest Neighbour Metric
- how to output more information about the constructed Rtree HOT 1
- QUESTION: How can rtree.index.Index properties be used to tweak performance ? HOT 2
- Linux binary wheels have two copies of libspatialindex HOT 1
- Calculating the Height of an R-Tree: Where Did I Go Wrong? HOT 1
- Issue with Python 3.12.0rc1 HOT 5
- "Unable to open file '%s' for index storage" - Write permissions on index should not be required HOT 1
- About RTree Data Structure Persistent Storage HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rtree.