#include #include #include #include #include int main(int argc, char** argv) { int flag; pid_t pid; pf_info_struct_t info; int count; void *mem_hogs[10000]; long i,j,k, randomi; float randomf; _syscall3(int, sys_pgfltstats, pid_t, pid, int, flag, pf_info_struct_t*, info); // tell the system call to only return values for the pid we give it flag = PGFLTSTAT_PROC; // get the pid of this process pid = getpid(); // allocate max memory i=0; while(1) { if ((mem_hogs[i]=malloc(512000)) == NULL) break; i++; } printf("Allocated %d 512k blocks before heap size limit\n",i); //sleep(10); for(j=0;j