Python: fixed writting out of memory.
Merge pull request #335 from shaitan/monitor

Python: fixed writting out of memory.