Please help with MemoryError

Jeremy jlconlin at gmail.com
Thu Feb 11 18:39:09 EST 2010


I have been using Python for several years now and have never run into
memory errors…

until now.

My Python program now consumes over 2 GB of memory and then I get a
MemoryError.  I know I am reading lots of files into memory, but not
2GB worth.  I thought I didn't have to worry about memory allocation
in Python because of the garbage collector.  On this note I have a few
questions.  FYI I am using Python 2.6.4 on my Mac.

1.    When I pass a variable to the constructor of a class does it
copy that variable or is it just a reference/pointer?  I was under the
impression that it was just a pointer to the data.
2.    When do I need to manually allocate/deallocate memory and when
can I trust Python to take care of it?
3.    Any good practice suggestions?

Thanks,
Jeremy



More information about the Python-list mailing list