1 // File : SMDS_MemoryLimit.cxx
2 // Created : Fri Sep 21 17:16:42 2007
3 // Author : Edward AGAPOV (eap)
5 // Executable to find out a lower RAM limit (MB), i.e. at what size of freeRAM
6 // reported by sysinfo, no more memory can be allocated.
7 // This is not done inside a function of SALOME because allocated memory is not returned
11 #include <sys/sysinfo.h>
18 int main (int argc, char ** argv) {
21 int err = sysinfo( &si );
24 unsigned long freeRamKb = ( si.freeram * si.mem_unit ) / 1024;
26 const unsigned long stepKb = 8; // less nb leads to hung up on Mandriva2006 without swap
27 // (other platforms not tested w/o swap)
29 unsigned long nbSteps = freeRamKb / stepKb * 2;
32 new char[stepKb*1024];
35 freeRamKb = ( si.freeram * si.mem_unit ) / 1024;
40 // std::cout << freeRamKb / 1024 << std::endl;
42 return freeRamKb / 1024;