and Post-Processing for numerical simulation. +Supports interoperability between CAD modeling and computation software (CAD-CAE link) +Makes easier the integration of new components on heterogeneous systems for numerical computation +Sets the priority to multi-physics coupling between computation software +Provides a generic user interface, user-friendly and efficient, which helps to reduce the costs and delays of carrying out the studies +Reduces training time to the specific time for learning the software solution which has been based on this platform +All functionalities are accessible through the programmatic integrated Python console This package contains SMESH module. WWW: http://www.salome-platform.org - Stas Timokhin devel@stasyan.com PR: ports/143469 Submitted by: Stas Timokhin <devel at stasyan.com>
56 lines
1.5 KiB
C++
56 lines
1.5 KiB
C++
--- src/SMDS/SMDS_Mesh.cxx.orig 2009-06-08 11:00:20.000000000 +0700
|
|
+++ src/SMDS/SMDS_Mesh.cxx 2009-06-08 11:35:21.000000000 +0700
|
|
@@ -42,8 +42,15 @@
|
|
using namespace std;
|
|
|
|
#ifndef WIN32
|
|
+#ifdef __FreeBSD__
|
|
+#include <sys/types.h>
|
|
+#include <sys/resource.h>
|
|
+#include <sys/sysctl.h>
|
|
+#include <sys/wait.h>
|
|
+#else
|
|
#include <sys/sysinfo.h>
|
|
#endif
|
|
+#endif
|
|
|
|
// number of added entitis to check memory after
|
|
#define CHECKMEMORY_INTERVAL 1000
|
|
@@ -59,10 +66,10 @@
|
|
int SMDS_Mesh::CheckMemory(const bool doNotRaise) throw (std::bad_alloc)
|
|
{
|
|
#ifndef WIN32
|
|
- struct sysinfo si;
|
|
- int err = sysinfo( &si );
|
|
- if ( err )
|
|
- return -1;
|
|
+// struct sysinfo si;
|
|
+// int err = sysinfo( &si );
|
|
+// if ( err )
|
|
+// return -1;
|
|
|
|
static int limit = -1;
|
|
if ( limit < 0 ) {
|
|
@@ -79,11 +86,17 @@
|
|
#endif
|
|
}
|
|
|
|
- const unsigned long Mbyte = 1024 * 1024;
|
|
- // compute separately to avoid overflow
|
|
- int freeMb =
|
|
- ( si.freeram * si.mem_unit ) / Mbyte +
|
|
- ( si.freeswap * si.mem_unit ) / Mbyte;
|
|
+// const unsigned long Mbyte = 1024 * 1024;
|
|
+ // compute separately to avoid overflow
|
|
+ long freeRam;
|
|
+ long pageSize;
|
|
+ size_t sizelong=sizeof(long);
|
|
+ sysctlbyname("vm.stats.vm.v_free_count",&freeRam,&sizelong,NULL,0);
|
|
+ sysctlbyname("hw.pagesize",&pageSize,&sizelong,NULL,0);
|
|
+// sysctlbyname();
|
|
+ int freeMb = freeRam*pageSize/1024;
|
|
+// ( si.freeram * si.mem_unit ) / Mbyte +
|
|
+// ( si.freeswap * si.mem_unit ) / Mbyte;
|
|
|
|
if ( freeMb > limit )
|
|
return freeMb - limit;
|