MemoryError on reading mbox file

David wizzardx at
Wed Sep 12 12:20:47 CEST 2007

> My system has 512M RAM and 768M swap, which seems to run out at an
> early stage of this. Is there a way to clean up memory for messages
> already processed?

It may be that Python's garbage collection isn't keeping up with your app.

You could try periodically forcing it to run. eg:

import gc

You can also finetune the GC settings and check what is using up your memory.

More info here:

More information about the Python-list mailing list