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 

Checking available memory

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



Joined: 12 Feb 2007
Posts: 57
Location: Sofia

PostPosted: Fri Aug 06, 2010 8:06 pm    Post subject: Checking available memory Reply with quote

Hi all.

Let me explain first...
I know that using malloc the PSPSDK initiates its own MM, allocates almost all of the memory, then provides me with what I need, but rendering sceKernelFreeMemory (or whatever it's named) not useful to retrieve the amount of free memory available.

Hence I wrote a simple procedure that will try to allocate blocks of memory (as it fails, it divides the block-size by 2 and tries again) till no memory is available and the block-size is 1...
So far, it appears to work good.

I notice, thou', then fopen'ing a file, and then fclose'ing it, leaves a memory leak. It varies in size, but for a 100-bytes text file it is like 392bytes. It may be bigger with images etc. etc.

Is it by design? Has it something to do with internal memory aligning?
Is my memory-check algo not working (so I may ask if there are any other ways - like maybe there are already functions of the internal MM, their prototype just not being yet exported in the .h file - I can check the free memory?

I need it just to double-check I am actually freeing all what I allocate; as I always write malloc's/new's and free's/delete's _together_, but you never know... ;-)

Cheers, A.
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Mon Aug 09, 2010 6:46 pm    Post subject: Reply with quote

Isn't there that header which you include and it warns of leaks at compile time? Forgot the name of the thing. Someone ported it to PSP.
Back to top
View user's profile Send private message
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