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

[pygame] Ridiculous memory usage!



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?

Oh, and to make matters more confusing, a couple times I've checked and Python is using a more modest ~6MB.  However, that's the exception and not the norm.

Any ideas?


Curtiss Howard