This question is for Harbour expert . But usually I'm directing to Fwh forum , because Harbour mailing list forum is terrible ... . So, I'll thankfull for your help ... I'm using succesfully this harbour scripts technique with hb_HrbRun() . After some tracks I noticed , that scripts are consumming PC memory and after job the scripts are in memoty . I'm thinking so , because after job memory size of applications isn't restoring to old size ...
Here is the code for prg as scripts :
- Code: Select all Expand view
function Run_prg( cPrg )
local oRun
local lRet := .t.
local lCompile := .f.
local dPrdDate, dHrbDate
local cPrgTime, cHrbTime
local cTxtFile, cLine, nFrom := 1
local cLog := cProgr_logai + "\hcmp" + alltrim( cVart_id ) + ".log"
if !jungtis_serveris()
return( .f. )
endif
if file( cProgr_kelias + cPrg + ".prg" )
TRY
if File( cLog )
ferase( cLog )
endif
FReOpen_Stderr( cLog, "w" )
oRun := HB_compilebuf( HB_ARGV( 0 ), cProgr_kelias + cPrg + ".prg", "-n", "-i" + cPagr_kelias + "fwh_incl;" + cPagr_kelias + "hrb_incl" )
cTxtFile := MemoRead( cLog )
if empty( cTxtFile )
if !Empty( oRun )
BEGIN SEQUENCE
bOldError = ErrorBlock( { | o | DoBreak( o ) } )
hb_HrbRun( oRun )
END SEQUENCE
ErrorBlock( bOldError )
else
MsgInf( "Can't to generate file ... :-( ", 2 )
endif
else
WinExec( "Notepad " + cLog )
endif
CATCH e
lRet := .f.
END
else
MsgInf( "Can't to find file - " + cProgr_kelias + cPrg + ".prg ...", 2 )
lRet := .f.
endif
if !empty( oRun )
oRun := NIL
endif
return( lRet )
static function DoBreak( oError )
local cInfo := oError:operation, n
if ValType( oError:Args ) == "A"
cInfo += " Args:" + CRLF
for n = 1 to Len( oError:Args )
MsgInfo( oError:Args[ n ] )
cInfo += "[" + Str( n, 4 ) + "] = " + ValType( oError:Args[ n ] ) + ;
" " + cValToChar( oError:Args[ n ] ) + CRLF
next
endif
MsgStop( oError:Description + CRLF + cInfo,;
"Script error at line: " + Str( ProcLine( 2 ) ) )
BREAK
return nil
Maybe it missing something here ? Or growing memory consumption with scripts is normal ? I'm doing like that :
if !empty( oRun )
oRun := NIL
endif
But this isn't releasing memory of script ? Memory leak problem ?
Thanks in advance ! With best regards !