hb_HrbRun()

hb_HrbRun()

Postby Rimantas » Wed Feb 01, 2012 7:20 pm

Hi,

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 !
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: hb_HrbRun()

Postby Antonio Linares » Thu Feb 09, 2012 8:18 pm

Rimantas,

Try this (before oRun := nil):

HB_HRBUNLOAD( oRun )
oRun = nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42097
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 28 guests