GP32 Ram Used/free


Pirotic

Certified Guru
Joined
Feb 16, 2004
Messages
593
Pretty much as the topic says, does anybody know a function or some code to return how much RAM the GP32 has used/free?

regards
Pirotic
 
indeed, seems to work!

it returns: 6660052

does anybody know how much RAM total the GP32 has when converted to bytes? (i assume this is displaying bytes)

i figure its (mb * 1,048,576) for bytes, but im sure one of you guys will correct me :D

couldn't find a function to show how much ram was used, so i'll have to work it out from the total :p
 
Personally, I use my own malloc/free functions, then I can keep track of everywhere I've used memory allocation, what for, and if I ever forget to free any (all memory allocations are stored in a linked list). It also means that memory allocation failures give a bit more informative output without having to check the result code all the time.

6660052 is indeed 6.35mb. (1mb = 1024*1024).
 
I wrote a very basic progam just to see what's the maximum chunk of memory I can allocate, using zmalloc().
After quite a few fine-tuned try-and-miss attempts, I turned out that maximal size of single, monolitic peace of RAM available to program is somewhere 5.7Mb <_< and goes downwards, depending of size of your program, static variables, and stack.
 
Back
Top