Could anyone let me know if they see why this would cause a memory issue? The user running the script let me know he got a message that he ran out of memory while the script was running.

EDIT: Originally this was being used by someone else on the large dataset, but now I am running on my machine and getting an 'Out of Memory' message. No error message is given in the python window. I just get a small popup that says 'Out of Memory', or once it just shut down ArcMap. I watched the performace tab in the Task Manager and it the memory just slowly rises the whole time. It goes through ~5000 points before giving this message. I thought maybe deleting the variables after each row might help (just a guess), but didn't seem to.

This is being run with ArcMap in the Python window. It takes the layers from the table of contents as inputs. Not ideal, but needed to use SelectByDimension which updates the mosaic dataset in ArcMap.

Task: iterate through points, get a date, filter a mosaic dataset of rasters with this date, and then get the cell value at the point location. I am not familiar enough with these operations to know what is building up in the memory. Anyone have any ideas.

def getSST(mosaicds,detections,dateField,longField,latField,sstField,reportID):
count = 1
with arcpy.da.UpdateCursor(detections,[dateField,longField,latField,sstField,reportID]) as cursor:
    for row in cursor:
        split = row[0].split("/")
        timestamp = "{}-{}-{}".format(split[2],split[0],split[1])
        coords = str(row[1])+" "+str(row[2])
        value = arcpy.GetCellValue_management(mosaicds,coords)
        SST = value.getOutput(0)
        if SST == "NoData":
            row[3] = -999
            row[3] = SST
        if count % 500 == 0:
            print count
        count += 1
        del split, timestamp, coords, value, SST
  • What makes you or your user think it is memory related? What is the precise symptom that the user is seeing? – PolyGeo Jun 21 '17 at 20:13
  • good comment, edited question. – Tangnar Jun 21 '17 at 20:17
  • What was the exact wording of that message? When did the user get it? Lots of print messages seen first or none? Can they run your small test OK? – PolyGeo Jun 21 '17 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.