Back to index

plt-scheme  4.2.1
rlimit_heapsize.c
Go to the documentation of this file.
00001 #ifndef DONT_NEED_MAX_HEAP_SIZE
00002 
00003 # include <sys/time.h>
00004 # include <sys/resource.h>
00005 # include <unistd.h>
00006 
00007 typedef unsigned long size_type;
00008 
00009 static size_type determine_max_heap_size(void) 
00010 {
00011   struct rlimit rlim;
00012 
00013 # ifdef OS_X
00014   getrlimit(RLIMIT_RSS, &rlim);
00015 # else  
00016   getrlimit(RLIMIT_DATA, &rlim);
00017 # endif
00018 
00019   return (rlim.rlim_cur == RLIM_INFINITY) ? (unsigned long)-1 : rlim.rlim_cur;
00020 }
00021 
00022 #endif