Script runs out of memory

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
abhiram
Posts: 7
Joined: Thu Oct 23, 2014 12:35 pm

Script runs out of memory

Post by abhiram »

Hello,

To briefly summarize, my script tries to read the temperature values at a bunch of weather stations (76) throughout the year. So for each day I create adde urls , access the temperature value using the url and write them to a file.

The problem is my script cannot handle more than ~50 days at a time. It basically eats up the memory (4gigs on my machine, but I have seen it chew through 8 gigs in no time). I have tried adding the following entries at the end of each iteration in my script without any success.

collectGarbage( )
removeAllData( )
removeAllLayers( )
boomstick()

After some digging around using the top program on my linux machine, I noticed two processes being launched for every iteration by the mcservl program present in the adde folder (textgserv ,areaaget).

Any ideas?

For your reference, I have attached a screenshot of the top program on my machine where you can see the process tree when I was running my script.

http://postimg.org/image/b747ouzvh/
Attachments
unidata.py
(2.08 KiB) Downloaded 366 times
User avatar
Rick
Posts: 404
Joined: Fri Jan 16, 2009 8:20 pm

Re: Script runs out of memory

Post by Rick »

Hi abhiram,

We started looking into your script and are working on a more efficient method of completing your task. Running several calls getADDEImage is not efficient. A preferred method would be to make one getADDEImage call and request the value for a given lat/lon. Couple of questions.

1) Are you trying to run this script from the jython shell or in the background? We have discovered when using the jython shell, code that implements long loops that include print statements will a lot of memory.
2) What version of McIDAS-V are you running?

Thanks,

Rick
Post Reply