forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Available memory?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Shapyi



Joined: 25 Apr 2005
Posts: 95

PostPosted: Sat Feb 16, 2008 9:16 am    Post subject: Available memory? Reply with quote

I wrote a basic program that uses the graphics source code from Lua Player (graphics.h) and I am using psplink to play around. Before running the code I run "meminfo" and get:

Code:
Memory Partitions:
N |    BASE    |   SIZE   | TOTALFREE |  MAXFREE  | ATTR |
--|------------|----------|-----------|-----------|------|
1 | 0x88000000 |  3145728 |    410112 |    396288 | 000C |
2 | 0x08800000 | 25165824 |  25069056 |  25069056 | 000F |
3 | 0x88000000 |  3145728 |    410112 |    396288 | 000C |
4 | 0x88300000 |  1048576 |   1048576 |   1048576 | 000C |


Then I run the program, load a small image (32 x 32 jpeg) and get:

Code:
Memory Partitions:
N |    BASE    |   SIZE   | TOTALFREE |  MAXFREE  | ATTR |
--|------------|----------|-----------|-----------|------|
1 | 0x88000000 |  3145728 |    403968 |    396288 | 000C |
2 | 0x08800000 | 25165824 |   1209856 |    951808 | 000F |
3 | 0x88000000 |  3145728 |    403968 |    396288 | 000C |
4 | 0x88300000 |  1048576 |   1048576 |   1048576 | 000C |


Where did all the memory go? How did it go from 25,069,056 bytes to a mere 1,209,856 bytes? I tried just initializing the the graphics and loading no images and got:

Code:
Memory Partitions:
N |    BASE    |   SIZE   | TOTALFREE |  MAXFREE  | ATTR |
--|------------|----------|-----------|-----------|------|
1 | 0x88000000 |  3145728 |    403968 |    396288 | 000C |
2 | 0x08800000 | 25165824 |  23298560 |  22088704 | 000F |
3 | 0x88000000 |  3145728 |    403968 |    396288 | 000C |
4 | 0x88300000 |  1048576 |   1048576 |   1048576 | 000C |


Is 'meminfo' accurate and the graphics code just wastes 20+ MB of RAM just to load a simple image? Is there any other way to get an accurate reading of the available memory?

Thank you.
Back to top
View user's profile Send private message
weltall



Joined: 20 Feb 2004
Posts: 310

PostPosted: Sat Feb 16, 2008 5:39 pm    Post subject: Reply with quote

depending on how your application is done it could be malloc alloching all the available ram to manage it by itself: in this case you won't be able to get from system runtimes the status of the ram. there were some little function who did little malloc operations till fulfilling the alloched block to get the size allocable (and so the size available trough malloc). obviously if this is the case the maximum you can use trough malloc is the size which you found missing
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group