There appears to be a run-away memory error when PyWin32 is used to connect to Satellite Tool Kit (STK) and grab data using the STK's COM API. This does not look like a problem with STK because when I use STK COM API in MatLab the memory consumption does not change. I have attached two files, which illustrate the problem. (Unfortunately, they require STK and Matlab licences ...)
stk_memleak.py connects to STK and grabs a (2000,3) array of data 10,000 times. Memory consumed by the Python process increases from 40MB at the start to 1.5GB at the end.
stk_memleak.m does the same thing in Matlab. Memory consumed by the Matlab process remains at approximately 230MB from the start to finish.
The line in Python code that causes the run-away memory problem is
arrsStk = prvStk.ExecSingleElementsArray(tsStk,['x','y','z'])
If I replace it with the a dummy data generator, the memory problem goes away. Deleting the variable, explicit garbage collection does not help.
The code is executed on Windows 7 SP1; Python 2.7.9; PyWin32 build 219; Matlab 2013B.