Register
Site Login
Site Search
Forums
Advertisement
Welcome to PocketMatrix. PocketMatrix is dedicated to providing the best online community for mobile device developers and enthusiests. What's new?

Memory


Memory

Postby Squirrel » Jun 2, 2006 @ 8:47pm

After loading bmp image of size 640x3072 by calling:
s_image->LoadImage(IDR_IMAGE),
application takes 9Mb RAM memory. Is that normal?
I mean 640*3072/1024/1024 == 1,86Mb. Have I missed something?
Squirrel
pm Member
 
Posts: 26
Joined: Jun 2, 2006 @ 3:56pm
Location: Rus


Re: Memory

Postby Presto » Jun 2, 2006 @ 10:37pm

Squirrel wrote:After loading bmp image of size 640x3072 by calling:
s_image->LoadImage(IDR_IMAGE),
application takes 9Mb RAM memory. Is that normal?
I mean 640*3072/1024/1024 == 1,86Mb. Have I missed something?

Actually, it's 640*372*2, since each pixel is 2 bytes (16bit color). That equals 3,932,160 bytes, which is closer to 4 megs. But you've also got to remember that it loads the image, then copies it into a Surface object, then frees the original memory, so for a moment it's in the memory twice. So, that memory that it freed is most likely still allocated/available to the application, but it's really only using the 4megs for the Surface.
User avatar
Presto
pm Insider
 
Posts: 763
Joined: Jan 20, 2003 @ 5:51am
Location: Kalesian Archipelago


Postby Guest » Jun 2, 2006 @ 10:54pm

Thanks for explanation, I was afraid it's some kind of bug. Is there any way to combat that problem? 3-4 images of this size make game imposible to run since they require too much memory.
Guest
 


Postby jaguard » Jun 2, 2006 @ 11:28pm

Anonymous wrote:Thanks for explanation, I was afraid it's some kind of bug. Is there any way to combat that problem? 3-4 images of this size make game imposible to run since they require too much memory.


Obvious solution: Split them up into smaller files :).
jaguard
pm Member
 
Posts: 230
Joined: Mar 2, 2004 @ 6:45pm


Postby BIGBEN » Jun 2, 2006 @ 11:53pm

If you use the XP/2000 taskbar - it won't give you any good numbers about what will happen on PPC.

640*3072[B]*2 bytes per 565 color[B]*/1024/1024 == 3,75MB

Do you measure it on PPC?
I hope you won't load this big surface at once in your game (you use it for testing purposes only) ;)
User avatar
BIGBEN
pm Member
 
Posts: 281
Joined: Mar 18, 2003 @ 10:18pm
Location: Saint-Petersburg, Russia


Postby Squirrel » Jun 3, 2006 @ 12:30pm

On PPC result is even worst (more memory). Since I use 256 color pallete, editing Surface class could help.

BIGBEN wrote:I hope you won't load this big surface at once in your game.

By the way, I did :lol: . But I need all that images to be loaded and used at one time. Would splitting them up help in that case?
Squirrel
pm Member
 
Posts: 26
Joined: Jun 2, 2006 @ 3:56pm
Location: Rus


Postby BIGBEN » Jun 3, 2006 @ 9:37pm

Squirrel wrote:On PPC result is even worst (more memory). Since I use 256 color pallete, editing Surface class could help.


Cool, it is a very good idea. If you manage to do it, please contribute ;)
How do you measure the space occupied by the program on a PPC?
What version of PHal do you use?
Release 0.7.6c
==============

All platforms:

- Fixed memory allocation issue with surfaces (too much memory was consumed).
User avatar
BIGBEN
pm Member
 
Posts: 281
Joined: Mar 18, 2003 @ 10:18pm
Location: Saint-Petersburg, Russia


Postby Squirrel » Jun 4, 2006 @ 1:26am

I use 0.7.7 PHal version (Still, splashscreen shows 0.7.3, what that could be?).

I haven't realy measured ocupied memory on PPC :wink:, it's just my guess, couse on desktop while the game is active, it is ocuping about 28 megs, and on PPC with 36 Mb free memory it didn't even run. Thought, there could be another reason.
Squirrel
pm Member
 
Posts: 26
Joined: Jun 2, 2006 @ 3:56pm
Location: Rus


Postby Presto » Jun 4, 2006 @ 1:52am

If the splashscreen is showing 0.7.3, you need to update it. Download the latest and overwrite the PocketHAL_xxx.lib files. (xxx=ARM, x86, EMU, etc.)

-John
User avatar
Presto
pm Insider
 
Posts: 763
Joined: Jan 20, 2003 @ 5:51am
Location: Kalesian Archipelago


Postby Squirrel » Jun 6, 2006 @ 3:06am

I've found the problem - it was just me ;). Lib files are located in subfolders in update archive, but I didn't notice that and just copied them in my PocketFrog folder.
After update memory appetite of my game came down from 24Mb to 15Mb. Quite decent.
Squirrel
pm Member
 
Posts: 26
Joined: Jun 2, 2006 @ 3:56pm
Location: Rus


Return to PocketFrog & PocketHAL


Sort


Forum Description

SDKs for fast and robust device-independent access to Pocket PC display hardware.

Moderators:

sponge, Kzinti

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