This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Where's all my Memory Going??


Where's all my Memory Going??

Postby gevans2000 » Nov 11, 2003 @ 11:45pm

I'm currently testing my game which will (hopefully) shortly be released on the Smartphone platform. While I have been testing it I have been trying to reduce the memory overhead it causes.

At the moment my game appears to use about 2.5Mb of memory. (I have yet to work out how to measure the memory overhead accurately - any advice welcome.)
This is not an unreasonable amount but it seems a little bit more than many commercial games already out on smartphone.

My first port of call was obviously this forum and I have read that changing the colour depth of PNG images can help. So I did this, changing every single image in my game from the standard 16M/24bit format that PaintShopPro saves them to, to 256Col/8bit.

The file sizes generally reduced (except for really small ones where the palette info obviously has taken up a large percentage of the file size) but the memory overhead seemed to remain absolutely the same.

I have to say I can't quite work out where this 2.5Mb has come from. I have about 70 CGapiSurfaces which are defined as global variables and are on the Stack (is this sensible?). Any surfaces which will not be used in the game again - such as intro splash screens etc - are freed by calling CGapiSurface(0,(DWORD)0,0).

The largest structure I have is a LEVEL struct. Sizeof reports that this is about 50000 bytes - so that seems ok. This is created on the heap using the new operator.

Apart from a few global DWORDs etc the only other major thing I have is a lookup table for sine and cosine values - so thats 2 arrays of doubles (should I be using doubles?) of size 360.

So thats about it. I don't profess in any way to be an expert C++ programmer so I could be making many elementary mistakes - hence all my little questions in brackets!!

If anybody has any general advice for me I would be eternally grateful. I realize what I've written is not particularly detailed but you guys all seem to be pretty clever. (My Mum always used to say that flattery will get you nowhere/everywhere!!)

One more question - in the GapiDraw docs it says a CGapiSurface takes up 64 bytes of memory. Why does sizeof(CGapiSurface) report that it's size is 300?

Anyway, thanks in advance for any help.
gevans2000
pm Member
 
Posts: 45
Joined: Jun 11, 2003 @ 6:02pm
Location: London UK


Postby muff » Nov 12, 2003 @ 12:47am

I believe (but may be wrong) that ALL surfaces that are create under GapiDraw are either 16 bit without alpha or 24 with alpha

this is for performance reasons, so that blits dont have to lookup every pixel's real colour in a palette before doing the actual blit

but what this also means is that despite reducing all your graphics down to 8 bit, they are stored on 16 bit surfaces in the game

if you are including the graphics in the exe, then you are also increasing the memory that the game is using

I would also suggest loading and unloading the surfaces as you need them, only holding in memory the ones you are actually needing at the time
muff
 


Postby ppcStudios » Nov 12, 2003 @ 1:10am

G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby Johan » Nov 12, 2003 @ 7:56am

Johan Sanneblad, M.Sc, Ph.D
GapiDraw Systems Architect
[]
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby StarFury » Nov 12, 2003 @ 8:04am

Don't know if this is of help, some talk of memory requirements at graphic load time:

<B><I> Earth Needs You! Don't Let Us Down - </I> <A target="_blank" HREF="http://www.pocketblasters.com">Galactic Assault - Invaders Turbo Edition - Teddies Revenge</A> [All for FREE!!]</B>
User avatar
StarFury
pm Member
 
Posts: 105
Joined: May 7, 2003 @ 3:11pm
Location: Norfolk, England


Postby gevans2000 » Nov 12, 2003 @ 4:28pm

gevans2000
pm Member
 
Posts: 45
Joined: Jun 11, 2003 @ 6:02pm
Location: London UK


Postby gevans2000 » Nov 12, 2003 @ 7:40pm

gevans2000
pm Member
 
Posts: 45
Joined: Jun 11, 2003 @ 6:02pm
Location: London UK


Postby Johan » Nov 20, 2003 @ 1:26pm

Johan Sanneblad, M.Sc, Ph.D
GapiDraw Systems Architect
[]
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby gevans2000 » Nov 20, 2003 @ 6:48pm

gevans2000
pm Member
 
Posts: 45
Joined: Jun 11, 2003 @ 6:02pm
Location: London UK


Return to GapiDraw


Sort


Forum Description

The Cross-platform Graphics SDK for Palms, Pocket PCs, Symbian Devices, and Stationary PCs.

Moderators:

sponge, Johan

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron