Mega Code Archive
Categories
/
C
/
Code Snippets
Get the current system free memory
#include
#include
int main(void) { char *p; long j; j = 0; do { p = malloc(1000); if(p) j += 1000; } while(p); printf("Approximately %ld bytes of free memory.", j); return 0; }