[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Ridiculous memory usage!



Dnia Mon, Jun 02, 2003 at 12:54:01PM +0000, Curtiss Howard pisze:

>I've written a program which is a "front-end" (menu system) for various
>emulators.  Whenever a game is highlighted on the menu a screenshot of
>the game is displaed "in the background" (that is, stretched to fill
>the screen and blitted before any foreground stuff).  The images are
>all PNG files with resolution approximately 320x240 or so (some
>slightly bigger, most are smaller) and they are being stretched to
>800x600 at run time.  The problem?  Insane memory consumption!  There
>are about 50 images total that are loaded all at once and Python is
>using up somewhere in the neighborhood of 130MB!  I've checked and
>images are loaded once and only once.  The only explanation for this
>behavior that I can think of is that Pygame is keeping an 800x600x32
>"raw copy" of every image in memory.  Is there no better way than that?

The images are converted to screen format (size and color depth), so it
seems possible.

-- 
Jarek Zgoda
Registered Linux User #-1
http://www.zgoda.biz/ JID:zgoda@chrome.pl http://zgoda.jogger.pl/