| View previous topic :: View next topic |
| Author |
Message |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Wed Jul 01, 2009 8:28 am Post subject: checking how much memory is left psplink |
|
|
i want to see how much memory is available on while using psplink how can i do this that way i can monitor how much my app is using and how much is free also as a note it uses alot of prx's so those each have some memory
i tried this but dont understand it
| Code: | meminfo
Memory Partitions:
N | BASE | SIZE | TOTALFREE | MAXFREE | ATTR |
---|------------|----------|-----------|-----------|------|
1 | 0x88000000 | 3145728 | 298752 | 279808 | 000C |
2 | 0x08800000 | 25165824 | 12107264 | 11914752 | 000F |
3 | 0x88000000 | 3145728 | 298752 | 279808 | 000C |
4 | 0x88300000 | 1048576 | 1048576 | 1048576 | 000C |
5 | 0x08400000 | 4194304 | 4194304 | 4194304 | 000F |
6 | 0x08800000 | 25165824 | 12107264 | 11914752 | 000F |
11 | 0x88000000 | 3145728 | 298752 | 279808 | 000C |
|
|
|
| Back to top |
|
 |
hrimfaxi
Joined: 23 Nov 2006 Posts: 22
|
Posted: Wed Jul 01, 2009 6:44 pm Post subject: |
|
|
You can mesaure free space by allocating heap memory until malloc failed:
| Code: |
unsigned int get_free_mem(void)
{
void *p[30];
unsigned int block_size = 0x04000000;
unsigned int block_free = 0;
int i = 0;
while ((block_size >>= 1) >= 0x0400)
{
if (NULL != (p[i] = malloc(block_size))) {
block_free |= block_size;
++i;
}
}
if (NULL != (p[i] = malloc(0x0400)))
{
block_free += 0x0400;
++i;
}
while (i--) {
free(p[i]);
}
return block_free;
}
|
|
|
| Back to top |
|
 |
Kreationz
Joined: 18 May 2008 Posts: 53
|
Posted: Fri Jul 03, 2009 6:27 pm Post subject: |
|
|
| Thx, I can use this to test for leaks... by checking after each ROM is run and then storing the free amount in a global and then checking the difference. By looking at the difference it should give my the size lost which would tell me at least partially where the leak is. As well as how much I have to work with for the buffers. |
|
| Back to top |
|
 |
|