Hey everyone,
I'm having problems with my app's ram usage as you can see from my previous questions.
I've tried this little piece of code:
void memcheck(void){
// perform free memory check
int blockSize = 16;
int i = 1;
debug("Checking memory with blocksize %d char ...\n", blockSize);
while (true) {
char *p = (char *) malloc(i * blockSize);
if (p == NULL){
break;
}
free(p);
++i;
}
debug("Ok for %d char\n", (i - 1) * blockSize);
}
That I found here to test for free memory.
I get this output:
Test for free memory Checking memory
with blocksize 16 char ...
Ok for 4752 char
And then my application just breaks. I've checked and it seems to me that the memory that was mallock'd should be freed, so I don't understand where this is wrong. What's more interesting is that this behavior is eerily similar to the behavior I get when I try running the lwip stack alongside my app (see here and here).
Can you guys help me understand what is going on here?