Salome HOME
BUG: GHS3DPlugin: Fixed a bug in the max memory computation V7_2_1
authorrnc <rnc@opencascade.com>
Mon, 1 Jul 2013 17:10:33 +0000 (17:10 +0000)
committerrnc <rnc@opencascade.com>
Mon, 1 Jul 2013 17:10:33 +0000 (17:10 +0000)
The default maximum memory was defined as a short integer which caused the maximum memory to be badly initialised on computers with big memory.
If the available memory was more than 32768 Mo (2**15 Mo) the max memory was cast from int to short and could be initialised with any value included a negative one. In this case a 20Mo default value was used by GHS3D

idl/GHS3DPlugin_Algorithm.idl
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx

index af17c879dd5624176b3edd2e67c7e2b23f7ae76b..2a608ddd744e3b2aadf898bda82ffeaf62c5e687 100644 (file)
@@ -76,15 +76,15 @@ module GHS3DPlugin
      * Maximal size of memory to be used by the algorithm (in Megabytes).
      * Negative value means not to use this option
      */
-    void SetMaximumMemory(in short MB) raises (SALOME::SALOME_Exception);
-    short GetMaximumMemory();
+    void SetMaximumMemory(in long MB) raises (SALOME::SALOME_Exception);
+    long GetMaximumMemory();
     /*!
      * Initial size of memory to be used by the algorithm (in Megabytes) in
      * automatic memory adjustment mode. Default is zero.
      * Negative value means not to use this option
      */
-    void SetInitialMemory(in short MB) raises (SALOME::SALOME_Exception);
-    short GetInitialMemory();
+    void SetInitialMemory(in long MB) raises (SALOME::SALOME_Exception);
+    long GetInitialMemory();
     /*!
      * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium
      */
index 437233c1c948f069469e9c7862b80895f57bfc83..a5001ae4af0c0458ec83825207906ddeab8cef57 100644 (file)
@@ -101,7 +101,7 @@ bool GHS3DPlugin_Hypothesis::GetToMeshHoles(bool checkFreeOption) const
 //function : SetMaximumMemory
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis::SetMaximumMemory(short MB)
+void GHS3DPlugin_Hypothesis::SetMaximumMemory(int MB)
 {
   if ( myMaximumMemory != MB ) {
     myMaximumMemory = MB;
@@ -114,7 +114,7 @@ void GHS3DPlugin_Hypothesis::SetMaximumMemory(short MB)
 //           * automatic memory adjustment mode. Default is zero
 //=======================================================================
 
-short GHS3DPlugin_Hypothesis::GetMaximumMemory() const
+int GHS3DPlugin_Hypothesis::GetMaximumMemory() const
 {
   return myMaximumMemory;
 }
@@ -123,7 +123,7 @@ short GHS3DPlugin_Hypothesis::GetMaximumMemory() const
 //function : SetInitialMemory
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis::SetInitialMemory(short MB)
+void GHS3DPlugin_Hypothesis::SetInitialMemory(int MB)
 {
   if ( myInitialMemory != MB ) {
     myInitialMemory = MB;
@@ -135,7 +135,7 @@ void GHS3DPlugin_Hypothesis::SetInitialMemory(short MB)
 //function : GetInitialMemory
 //=======================================================================
 
-short GHS3DPlugin_Hypothesis::GetInitialMemory() const
+int GHS3DPlugin_Hypothesis::GetInitialMemory() const
 {
   return myInitialMemory;
 }
@@ -766,7 +766,7 @@ bool GHS3DPlugin_Hypothesis::DefaultMeshHoles()
 #include <windows.h>
 #endif
 
-short  GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
+int  GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
 {
 #ifndef WIN32
   struct sysinfo si;
@@ -795,7 +795,7 @@ short  GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
 //function : DefaultInitialMemory
 //=======================================================================
 
-short  GHS3DPlugin_Hypothesis::DefaultInitialMemory()
+int  GHS3DPlugin_Hypothesis::DefaultInitialMemory()
 {
   return DefaultMaximumMemory();
 }
@@ -1368,7 +1368,7 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h
   // Default memory is defined at ghs3d installation but it may be not enough,
   // so allow to use about all available memory
   if ( m ) {
-    short aMaximumMemory = hyp ? hyp->myMaximumMemory : -1;
+    int aMaximumMemory = hyp ? hyp->myMaximumMemory : -1;
     cmd += " -m ";
     if ( aMaximumMemory < 0 )
       cmd += DefaultMaximumMemory();
@@ -1376,7 +1376,7 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h
       cmd += aMaximumMemory;
   }
   if ( M && !useBndRecovery ) {
-    short aInitialMemory = hyp ? hyp->myInitialMemory : -1;
+    int aInitialMemory = hyp ? hyp->myInitialMemory : -1;
     cmd += " -M ";
     if ( aInitialMemory > 0 )
       cmd += aInitialMemory;
index c75610460b6732c2c8e57cc23b4ede0c1d656b23..348b14942493631e6d74a48d5645db953be1deb5 100644 (file)
@@ -127,14 +127,14 @@ public:
   /*!
    * Maximal size of memory to be used by the algorithm (in Megabytes)
    */
-  void SetMaximumMemory(short MB);
-  short GetMaximumMemory() const;
+  void SetMaximumMemory(int MB);
+  int GetMaximumMemory() const;
   /*!
    * Initial size of memory to be used by the algorithm (in Megabytes) in
    * automatic memory adjustment mode. Default is zero
    */
-  void SetInitialMemory(short MB);
-  short GetInitialMemory() const;
+  void SetInitialMemory(int MB);
+  int GetInitialMemory() const;
   /*!
    * Optimization level: 0-none, 1-light, 2-medium, 3-standard+, 4-strong. Default is medium
    */
@@ -266,8 +266,8 @@ public:
   void ClearGroupsToRemove();
   
   static bool   DefaultMeshHoles();
-  static short  DefaultMaximumMemory();
-  static short  DefaultInitialMemory();
+  static int    DefaultMaximumMemory();
+  static int    DefaultInitialMemory();
   static short  DefaultOptimizationLevel();
   static std::string DefaultWorkingDirectory();
   static bool   DefaultKeepFiles();
@@ -313,8 +313,8 @@ public:
 private:
 
   bool   myToMeshHoles;
-  short  myMaximumMemory;
-  short  myInitialMemory;
+  int    myMaximumMemory;
+  int    myInitialMemory;
   short  myOptimizationLevel;
   bool   myKeepFiles;
   std::string myWorkingDirectory;
index bedaf31809f971915eddb2b25ced9297bfed7167..791566121d001c33a9aaa8480c5e69313db7e4ab 100644 (file)
@@ -94,7 +94,7 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMeshHoles()
 //function : SetMaximumMemory
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Short MB)
+void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Long MB)
    throw ( SALOME::SALOME_Exception )
 {
   if ( MB == 0 )
@@ -108,7 +108,7 @@ void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Short MB)
 //function : GetMaximumMemory
 //=======================================================================
 
-CORBA::Short GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
+CORBA::Long GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
 {
   ASSERT(myBaseImpl);
   return this->GetImpl()->GetMaximumMemory();
@@ -118,7 +118,7 @@ CORBA::Short GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
 //function : SetInitialMemory
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Short MB)
+void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Long MB)
   throw ( SALOME::SALOME_Exception )
 {
   if ( MB == 0 )
@@ -132,7 +132,7 @@ void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Short MB)
 //function : GetInitialMemory
 //=======================================================================
 
-CORBA::Short GHS3DPlugin_Hypothesis_i::GetInitialMemory()
+CORBA::Long GHS3DPlugin_Hypothesis_i::GetInitialMemory()
 {
   ASSERT(myBaseImpl);
   return this->GetImpl()->GetInitialMemory();
index f3164adb1224d3c9af9267767023b28b1403c3cc..4ac8b6f163760fff6740146c10504927d0aa223e 100644 (file)
@@ -58,14 +58,14 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i:
   /*!
    * Maximal size of memory to be used by the algorithm (in Megabytes)
    */
-  void SetMaximumMemory(CORBA::Short MB) throw ( SALOME::SALOME_Exception );
-  CORBA::Short GetMaximumMemory();
+  void SetMaximumMemory(CORBA::Long MB) throw ( SALOME::SALOME_Exception );
+  CORBA::Long GetMaximumMemory();
   /*!
    * Initial size of memory to be used by the algorithm (in Megabytes) in
    * automatic memory adjustment mode. Default is zero
    */
-  void SetInitialMemory(CORBA::Short MB) throw ( SALOME::SALOME_Exception );
-  CORBA::Short GetInitialMemory();
+  void SetInitialMemory(CORBA::Long MB) throw ( SALOME::SALOME_Exception );
+  CORBA::Long GetInitialMemory();
   /*!
    * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium
    */