From: eap Date: Fri, 8 Jun 2007 08:53:45 +0000 (+0000) Subject: NPAL16132 (GHS3D execution failed in Salome version 4.0.0) X-Git-Tag: V4_1_0a1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3526b81aad9ea335c82bcf97046d58995dd2b464;p=plugins%2Fhybridplugin.git NPAL16132 (GHS3D execution failed in Salome version 4.0.0) implement adjustMemory() without calling ghs3d --- diff --git a/src/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin_GHS3D.cxx index 52f19e9..2e5ef82 100644 --- a/src/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin_GHS3D.cxx @@ -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 ); +// } } //=============================================================================