mvolz47

Use Subprocess to Alleviate Memory Usage Issues

Discussion created by mvolz47 on Feb 7, 2012
Latest reply on Feb 8, 2012 by mvolz47
To All Python Users:

I have a script that is updating mxds and then saving them.  After saving the mxd I am deleting the mxd object, but memory usage keeps increasing until the python script just hangs.

I have read that I can use a subprocess to fix this problem, but I am unsure of the syntax to use.  I will be drilling down through a directory and all of its subdirectories for mxd files (This will be my main python script).  Once I have an mxd file as the focus, I want to use a subprocess to start another python script that will open the mxd, replace data sources, save the mxd and then delete the mxd object from memory.  Then I will return to the main script to get another file which should free up memory as the subprocess has terminated.

Does anyone know the syntax I would use to call the secondary python script with an argument being the mxd file that has the focus?  Any help or hints are greatly appreciated.  Thank you.

Outcomes