Memory Control - Can you get the memory usage of the interpreter?

Ian info at fretfarm.co.uk
Fri Jul 9 19:43:58 EDT 2004


Hi all,

I have a problem. I have an application which needs to work with a lot of
data, but not all at the same time. It is arranged as a set of objects, each
with lots of data that is created when the object is instantiated.

I'd ideally like to keep as many objects as possible in memory, but I can
get rid of any object the program isn't currently using.

Is there any way I can access the amount of memory python is using? I can
then decide when to give up objects to the gc.

I don't want to use weakref because the gc simply collects weakref'ed stuff
whether memory is tight or not, and then I have to recreate it (which is
costly). I only have one internal consumer for the data, and it is only
working with one object at once, but may change to a different object at any
time.

Thanks in advance

Ian.





More information about the Python-list mailing list