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