diff --git a/Box/Box.cpp b/Box/Box.cpp index 0ae21e7bcd909b63a119a5422966421a31932ee3..2ef2359d7b3a83fbf5e6dfcb4352adeeede8f8e6 100644 --- a/Box/Box.cpp +++ b/Box/Box.cpp @@ -1,4 +1,4 @@ -// $Id: Box.cpp,v 1.33 2006-12-16 15:44:27 geuzaine Exp $ +// $Id: Box.cpp,v 1.34 2007-03-18 14:12:20 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -21,6 +21,7 @@ #include <signal.h> #include "Gmsh.h" +#include "OS.h" #include "Numeric.h" #include "Geo.h" #include "Generator.h" @@ -95,6 +96,8 @@ int GMSHBOX(int argc, char *argv[]) signal(SIGFPE, Signal); #endif + CheckResources(); + GMSH_PluginManager::instance()->registerDefaultPlugins(); check_gsl(); diff --git a/Box/Makefile b/Box/Makefile index b97af7b864af5ed3153612d117c5119d4d272418..b8f25d84774d925ddaa0cdec0e77380465998a26 100644 --- a/Box/Makefile +++ b/Box/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.34 2007-02-26 16:24:23 geuzaine Exp $ +# $Id: Makefile,v 1.35 2007-03-18 14:12:20 geuzaine Exp $ # # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle # @@ -53,8 +53,8 @@ depend: # DO NOT DELETE THIS LINE Box.o: Box.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \ ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \ - ../DataStr/List.h ../DataStr/Tree.h ../Numeric/Numeric.h ../Geo/Geo.h \ - ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \ + ../DataStr/List.h ../DataStr/Tree.h ../Common/OS.h ../Numeric/Numeric.h \ + ../Geo/Geo.h ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \ ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \ ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \ ../Geo/SPoint2.h ../Geo/ExtrudeParams.h ../Common/SmoothData.h \ diff --git a/Common/OS.cpp b/Common/OS.cpp index 4660bbe064ce385b4ff1744d75bb4034e09061a5..ef8fcd1818dccadc7afddbd5adbe535216f6af2c 100644 --- a/Common/OS.cpp +++ b/Common/OS.cpp @@ -1,4 +1,4 @@ -// $Id: OS.cpp,v 1.5 2006-11-27 22:22:07 geuzaine Exp $ +// $Id: OS.cpp,v 1.6 2007-03-18 14:12:20 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -91,6 +91,23 @@ void GetResources(double *s, long *mem) #endif } +void CheckResources(){ +#if !defined (WIN32) || defined(__CYGWIN__) + static struct rlimit r; + + getrlimit(RLIMIT_STACK, &r); + + // Try to get at least 1 MB of stack. Running with too small a stack + // can cause crashes in the recursive calls (e.g. for tet + // classification in 3D Delaunay) + if(r.rlim_cur < 1024 * 1024){ + Msg(INFO, "Increasing process stack size (%d kB < 1 MB)", r.rlim_cur / 1024); + r.rlim_cur = r.rlim_max; + setrlimit(RLIMIT_STACK, &r); + } +#endif +} + double Cpu() { long mem = 0; diff --git a/Common/OS.h b/Common/OS.h index 00e194f09e05d3b579484122a4c2f062e1c164df..57232f73283cb4bbc69b0366e79086d7204211d4 100644 --- a/Common/OS.h +++ b/Common/OS.h @@ -23,6 +23,7 @@ double GetTimeInSeconds(); void SleepInSeconds(double s); void GetResources(double *s, long *mem); +void CheckResources(); double Cpu(); int GetProcessId(); int UnlinkFile(char *name); diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index 106199bf4a574ec8ad04b0ec0ca0574de2b19776..31ad694461551daf7917b683de444229c26a1e1b 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.104 2007-02-04 11:24:55 geuzaine Exp $ +// $Id: Main.cpp,v 1.105 2007-03-18 14:12:20 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -25,6 +25,7 @@ #include "GUI.h" #include "Gmsh.h" #include "GmshUI.h" +#include "OS.h" #include "Geo.h" #include "Generator.h" #include "CreateFile.h" @@ -105,6 +106,8 @@ int main(int argc, char *argv[]) signal(SIGFPE, Signal); #endif + CheckResources(); + // Initialize the default plugins GMSH_PluginManager::instance()->registerDefaultPlugins(); diff --git a/Fltk/Makefile b/Fltk/Makefile index c798c81961e032cc52e10c796e1ae68eda045333..74ff3aca3f5d6e9508262f77edf11135062ff56c 100644 --- a/Fltk/Makefile +++ b/Fltk/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.126 2007-02-28 06:58:46 geuzaine Exp $ +# $Id: Makefile,v 1.127 2007-03-18 14:12:20 geuzaine Exp $ # # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle # @@ -68,28 +68,28 @@ Main.o: Main.cpp GUI.h Opengl_Window.h Colorbar_Window.h \ SpherePosition_Widget.h ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \ - ../Geo/Geo.h ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \ - ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \ - ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \ - ../Geo/SPoint2.h ../Geo/ExtrudeParams.h ../Common/SmoothData.h \ - ../Numeric/Numeric.h ../Mesh/Generator.h ../Parser/CreateFile.h \ - ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h \ - ../Common/VertexArray.h ../Common/SmoothData.h \ - ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Common/Context.h \ - ../Common/Options.h ../Parser/Parser.h ../Parser/OpenFile.h \ - ../Common/CommandLine.h Solvers.h ../Plugin/PluginManager.h \ - ../Plugin/Plugin.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \ - ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \ - ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/GPoint.h ../Geo/SPoint2.h \ - ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h \ - ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/MElement.h ../Geo/MVertex.h \ - ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \ - ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h \ - ../Geo/ExtrudeParams.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \ - ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/MElement.h ../Geo/SPoint2.h \ - ../Geo/SVector3.h ../Geo/Pair.h ../Geo/ExtrudeParams.h ../Geo/GRegion.h \ - ../Geo/GEntity.h ../Geo/MElement.h ../Geo/ExtrudeParams.h \ - ../Geo/SBoundingBox3d.h + ../Common/OS.h ../Geo/Geo.h ../Common/GmshDefines.h \ + ../Geo/gmshSurface.h ../Geo/Pair.h ../Geo/Range.h ../Geo/SPoint2.h \ + ../Geo/SPoint3.h ../Geo/SVector3.h ../Geo/SPoint3.h \ + ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/SPoint2.h \ + ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Numeric/Numeric.h \ + ../Mesh/Generator.h ../Parser/CreateFile.h ../Graphics/Draw.h \ + ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \ + ../Common/SmoothData.h ../Common/AdaptiveViews.h ../Common/GmshMatrix.h \ + ../Common/Context.h ../Common/Options.h ../Parser/Parser.h \ + ../Parser/OpenFile.h ../Common/CommandLine.h Solvers.h \ + ../Plugin/PluginManager.h ../Plugin/Plugin.h ../Geo/GModel.h \ + ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ + ../Geo/SBoundingBox3d.h ../Geo/MVertex.h ../Geo/SPoint3.h \ + ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h \ + ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \ + ../Geo/MElement.h ../Geo/MVertex.h ../Geo/MEdge.h ../Geo/MVertex.h \ + ../Geo/SVector3.h ../Common/Hash.h ../Geo/MFace.h ../Geo/MVertex.h \ + ../Geo/SVector3.h ../Geo/ExtrudeParams.h ../Geo/GFace.h ../Geo/GPoint.h \ + ../Geo/GEntity.h ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/MElement.h \ + ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/ExtrudeParams.h \ + ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \ + ../Geo/ExtrudeParams.h ../Geo/SBoundingBox3d.h Message.o: Message.cpp ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \