]> SALOME platform Git repositories - plugins/ghs3dplugin.git/commitdiff
Salome HOME
NPAL16132 (GHS3D execution failed in Salome version 4.0.0)
authoreap <eap@opencascade.com>
Fri, 8 Jun 2007 08:53:45 +0000 (08:53 +0000)
committereap <eap@opencascade.com>
Fri, 8 Jun 2007 08:53:45 +0000 (08:53 +0000)
   implement adjustMemory() without calling ghs3d

src/GHS3DPlugin_GHS3D.cxx

index 52f19e93e3db7c17d0546c6dd5870a035dfe1605..2e5ef82cb796a9c0a18d732d82cbfd6fb06a4432 100644 (file)
@@ -508,20 +508,30 @@ static bool findLineContaing(const TCollection_AsciiString& theText,
 
 static void adjustMemory(int & nbMB, const TCollection_AsciiString & aLogFileName)
 {
-  TCollection_AsciiString cmd( "ghs3d -m " );
-  cmd += nbMB;
-  cmd += " 1>";
-  cmd += aLogFileName;
-
-  system( cmd.ToCString() ); // run
-
-  // analyse log file
-  TCollection_AsciiString foundLine;
-  if ( findLineContaing( "UNABLE TO ALLOCATE MEMORY",aLogFileName,foundLine))
-  {
+  // the second call to ghs3d hangs up until C-d RET typed in terminal,
+  // if SALOME was launched with args, so we check memory allocation ourself
+  try {
+    char* buf = new char[ nbMB * 1024 * 1024 ];
+    delete [] buf;
+  }
+  catch (...) {
     nbMB = int( double(nbMB) * 0.75 );
     adjustMemory( nbMB, aLogFileName );
   }
+//   TCollection_AsciiString cmd( "ghs3d -m " );
+//   cmd += nbMB;
+//   cmd += " 1>";
+//   cmd += aLogFileName;
+
+//   system( cmd.ToCString() ); // run
+
+//   // analyse log file
+//   TCollection_AsciiString foundLine;
+//   if ( findLineContaing( "UNABLE TO ALLOCATE MEMORY",aLogFileName,foundLine))
+//   {
+//     nbMB = int( double(nbMB) * 0.75 );
+//     adjustMemory( nbMB, aLogFileName );
+//   }
 }
 
 //=============================================================================