Re: Minimizing executable memory usage

"Byron Guernsey" <byron-s/[email protected]> Fri, 26 Aug 2005 11:00:01 -0400
Newsgroups gmane.comp.windows.ce.freeware
Message-ID <000701c5aa4e$d60b1a30$0a00a8c0@antigravity>
Thanks for the response, I've been out of town and unable to respond.

I made some flawed assumptions and need to get the data on memory usage from 
the PocketPC itself rather than using the PC version to estimate.

However, having said that, I'm still looking for any tricks to keep memory 
usage low, regardless of the level its at now.

Is there any memory usage benefit to memory mapping files off SD cards?  For 
instance, all of my graphics are current compressed to save memory.  But 
that means that they still must be decompressed entirely to memory before 
being used.  With an SD card, I might be able to memory map the resource 
file and leave the graphics uncompressed, then reference them straight from 
the card.  I use a cache for graphics today, but the images contain tile 
sets rather than single tiles.  So when a tile is needed, its image is first 
decompressed to a large buffer, then the rect section is blit to another 
buffer in the cache for future reference.  I free the large buffer only when 
a new tile sheet is referenced to avoid the decompression overhead on each 
reference.  Its a LRU cache and I can adjust the memory usage on it.

So I might be able to eliminate usage of the large buffer that holds the 
tile sheet image by storing the images decompressed on the SD card and 
memory mapping the files when blitting into the smaller cache.

But I do need to take a look at the memory usage from the PocketPC api you 
mentioned first. However, thats an example of the memory saving techniques 
I'm looking for.  Things seem ok on the PocketPC right now, but SmartPhone's 
might be tricky to support with the current footprint.

Byron


----- Original Message ----- 
From: "Keuchel, Rainer" <keuchel-ypdxL0zNX99Wk0Htik3J/[email protected]>
To: <[email protected]>
Sent: Friday, August 19, 2005 5:07 AM
Subject: RE: [wince-devel] Minimizing executable memory usage


>> The executable itself, when compiled for Release, is 193,536
>> bytes.  It uses the GDAPIDraw library, which is a DLL of about 350,000
> bytes,
>> and the Hekkus Sound DLL 140,000 bytes.
>
> I do not understand why you are talking about code bloat then,
> and I doubt that your 8 MEG on Win32 is real memory usage, maybe
> it's just reserved virtual mem..
>
> There is a WinCE API function that can be used for measuring overall
> memory usage of the system.
>
>  char buf[256];
>  MEMORYSTATUS ms;
>
>  memset(&ms, 0, sizeof(ms));
>  ms.dwLength = sizeof(ms);
>
>  GlobalMemoryStatus(&ms);
>
>  sprintf(buf,
>   "Load: %d "
>   "TotalPhys: %d AvailPhys: %d "
>   "TotalPage: %d AvailPage: %d "
>   "TotalVirt: %d AvailVirt: %d",
>   ms.dwMemoryLoad,
>   ms.dwTotalPhys, ms.dwAvailPhys,
>   ms.dwTotalPageFile, ms.dwAvailPageFile,
>   ms.dwTotalVirtual, ms.dwAvailVirtual);
>
>
>
> ------------------------------------
> Visit us at : www.allgeier.com
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
> 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/W4wwlB/TM
--------------------------------------------------------------------~->