How To Check Free Mem Available


JyCet

Member
Joined
Feb 23, 2004
Messages
469
Age
118
Location
France
Website
Visit site
Me again :)
Someone know how to check the free RAM memory available under gp2x ?
Thanks again !

Edit:
I just see some interesting thing with /proc/self/statm :)
 
Yes vimacs, it work very nice but only in cmd line :(

I search to do the same thing in a program :)

Hum. statm give us theorically the memory used by the actual process.
I've tested that:
Code:
void memused(void) {
	FILE *statm=fopen("/proc/self/statm", "r");
	if (statm) {
		unsigned long int size;
		if (fscanf(statm, "%lu",&size)==1) {
			fprintf(stdout, "Memory used: %lu Mo\n",(size*4)/1024);
		} else {
			/* FIXME */
		}
		if (fclose(statm)) {
			/* FIXME */
		}
	} else {
		/* FIXME */
	}
	return;
}
I use SDL HW lib and it game me 6MB, so it's normally the memory allocated by HW SDL
I progress :)
 
Back
Top