#include #include #define KB 1024 #define MB (KB*KB) #define GB (MB*KB) int main(void) { int testMb; char *mem; long testHeap; for(testMb=1;testMb<2314;testMb++) { testHeap = MB*testMb; mem = (char*)mmap(0, testHeap, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0); if(mem == MAP_FAILED) { printf("Couldn't allocate the heap: %dMb\n",testMb); return 1; } munmap(mem, testHeap); } printf("test ok\n"); return 0; }