[python-win32] How to calc amount of avail RAM in a process ?

Tim Roberts timr at probo.com
Thu Jan 29 19:20:30 CET 2009


geoff wrote:
> I am hoping someone could steer me in the right direction on how to
> calculate the amount of RAM available to a process.
>
> I found the post below from Tim Roberts - a belated thanks Tim for
> your patient responses ! and it seems we regularly hit this limit.
>
> We have an application that needs to display a large number of bitmaps
> (ie 100+) at one time.  Currently we are just reading the file and
> storing as a wx.Image in RAM.  I would seem we are hitting the 2.0G
> limited mentioned in the post below and I am wondering if there is
> some strategy we could use to go beyond this -- other than thumbnails
> and reading as necessary from the filesystem.
>   

There's no easy fix.  Thumbnails and some kind of least-recently-used
caching scheme are probably your best choices.  As Steven pointed out,
you could always install a Win64 system and a 64-bit Python.  Then, you
can get about 8TB of process space.  However, that's not particularly
friendly to your end users, if you need to distribute this.

> At minimum though I would like to be able to 'prompt' the user to
> close some applications (ie mail clients, spreadsheets, etc) to free
> up some more space before our process starts.
> --- or would that even make a difference ?
>   

No.  The 2GB address space limit is per process.  It doesn't matter what
other processes are doing.  You can even have several processes using
2GB of memory, although your disk will get a good workout.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list