Report Inappropriate Content
Top Print
This Forum is closed for replies.
|
| Subject |
Is there a known memory leak in the geoprocessor of ArcGIS 9.1? |
| Author |
Ronnen Levinson |
| Date |
Nov 13, 2005 |
| Message |
Hi.
I have found that calling certain functions that check for, delete, or create rasters in a personal geodatabase--e.g.,
GP.exists()
GP.delete()
GP.Clip_management()
GP.ExtractByPolygon_sa()
-- leads PythonWin (2.4 and 2.1; I've tried both) to consume ever-increasing amounts of memory. For example, if I have a geodatabase workspace that contains many rasters, 100 calls to GP.exists() increases PythonWin memory use by about 25 MB.
I observe the same sort of trouble when executing the code below, which populates a geodatabase with many small rasters, each extracted by polygon from a large raster. After several hundred iterations, PythonWin's memory consumption increases to 1 GB from about 100 MB, and the geoprocessor aborts with a complaint about memory availability.
I have tried removing (via del) the result of those calls that return values, such as GP.exists; this has no useful effect.
Is there a known memory leak in the geoprocessor, or perhaps a known tendency toward gratuitious caching? Is there any way to avoid the problems I describe, and/or encourage the geoprocessor (rather than Python) to perform garbage collection?
Thanks,
Ronnen. |
| |
clippedRasterExists = GP.exists(clippedRaster)
for i in range(nrows):
outRaster = labelList[i]
outRasterExists = outRaster in outWorkspaceRasters
if overWrite and outRasterExists:
print "Deleting " + outRaster
GP.delete(outRaster)
if (not outRasterExists) or overWrite:
inPolygon = polygonList[i]
inBoundingBox = boundingBoxList[i]
if clippedRasterExists:
print "Deleting " + clippedRaster
GP.delete(clippedRaster)
print str(i) + ": Creating clipped raster " + clippedRaster + " ("+inBoundingBox+")"
GP.Clip_management(inWorkspace + "/" + inRaster, inBoundingBox, clippedRaster)
clippedRasterExists = True
print str(i) + ": Creating new " + outRaster
GP.ExtractByPolygon_sa(clippedRaster, inPolygon, outRaster, "INSIDE")
else:
print str(i) + ": Skipping " + outRaster + " (already exists)" |
| |
Ronnen Levinson
ArcView 9.1
Python 2.4
WinXP Pro SP2
3.2GHz P4, 3GB RAM |
| |
|