Ayuda con Mensaje Error irrecuperable 9009: hb_xrealloc

Ayuda con Mensaje Error irrecuperable 9009: hb_xrealloc

Postby Adolfo » Wed Mar 20, 2024 7:40 pm

Hello Fivewinners.
Hola Fivewinners

Need to open 160.000+ xml files and extract some info
Necesito abrir mas de 160.000 archivos xml y sacar informacion

I use tXmlDocument class
Uso la clase TxmlDocument

I have the file names in an Array
Tengo los nombres de los archivos en un arreglo

Code: Select all  Expand view


    For X=1 to 160.xxx

        If z=400
           HB_GcAll()
           SysRefresh()
           z:=0
        Endif

        LeeFileXml(hFile[x])
 
    Next
--------------------------------------
--------------------------------------
Function LeeFile Xml(hFile)
Local oXmlDoc := TXmlDocument():New( hFile )
Local oXmlIter := TXmlIterator():New( oXmlDoc:oRoot )
Local Data1:=0
Local Data2:=""

   while .T.
         oTagActual = oXmlIter:Next()
         If oTagActual != nil

            If oTagActual:cName ="END"
              Exit
            Endif

           If oTagActual:cName ="ValorXxx"
              Data1:=Val(oTagActual:cData)
           Endif

           If oTagActual:cName ="ValorYyy"
              Data2:=oTagActual:cData
           Endif

      End

FClose( hFile )
oXmlDoc:=Nil
oXmlIter:=Nil

 oSvr:Insert("detalle",{"NUMERO","DESCRIPCION"},{Data1,Data2})

Return Nil


 


It does what it is supposed to do, But I get this error each time Between 5.000 and 6.000 processed files
Hace lo que se supone debe hacer, pero tengo cada vez tengo este error entre los 5.000 y 6.000 archivos procesados

Application Internal Error - C:\SQL\xNewAqua\xNewII.Exe
Terminated at: 2024-03-20 16:18:46
Error irrecuperable 9009: hb_xrealloc no puede reubicar la memoria......


It fails in no specific file, just after 5000+ file
No falla en ningun archivo especifico, solo despues de los 5000

Any help will be appreciated
Cualquier ayuda se agradece

HARBOUR, FWH, MSVC, WINDOWS 11, 32GB ram, NVME disk
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1650
User avatar
Adolfo
 
Posts: 846
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: Ayuda con Mensaje Error irrecuperable 9009: hb_xrealloc

Postby Adolfo » Thu Mar 21, 2024 1:04 am

Encontre el error

Deshabilite el Avast Antivirus y funciona de maravilla
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1650
User avatar
Adolfo
 
Posts: 846
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: Ayuda con Mensaje Error irrecuperable 9009: hb_xrealloc

Postby karinha » Thu Mar 21, 2024 12:12 pm

Adolfo, buenos días. Apagar el antivirus es extremadamente peligroso. Lo mejor es cambiar al antivirus AVG (mucho mejor que AVAST) y yo haría su rutina como se muestra a continuación, pruebe a ver qué sucede, por favor.

Code: Select all  Expand view

FUNCTION TU_Func()

   // inicio
   hb_gcAll( .F. )

   FOR X = 1 TO 160.xxx

      SYSREFRESH()

      IF z = 400

         // HB_GcAll()

         // SysRefresh()

         z := 0

      ENDIF

      LeeFileXml( hFile[ x ] )

   NEXT

   // Salida
   hb_gcAll( .T. )

RETURN NIL

FUNCTION LeeFile Xml( hFile )

   LOCAL oXmlDoc := TXmlDocument():New( hFile )
   LOCAL oXmlIter := TXmlIterator():New( oXmlDoc:oRoot )
   LOCAL Data1 := 0
   LOCAL Data2 := ""

   hb_gcAll( .F. )

   WHILE( .T. )

      SYSREFRESH() // aqui

      oTagActual = oXmlIter:Next()

      IF oTagActual != nil

         IF oTagActual:cName = "END"

            EXIT

         ENDIF

         IF oTagActual:cName = "ValorXxx"

            Data1 := Val( oTagActual:cData )

         ENDIF

         IF oTagActual:cName = "ValorYyy"

            Data2 := oTagActual:cData

         ENDIF

      ENDIF

   ENDDO // ??

   FClose( hFile )

   oXmlDoc  := Nil
   oXmlIter := Nil

   oSvr:Insert( "detalle", { "NUMERO", "DESCRIPCION" }, { Data1, Data2 } )

   hb_gcAll( .T. )

RETURN NIL
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7213
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Ayuda con Mensaje Error irrecuperable 9009: hb_xrealloc

Postby Adolfo » Thu Mar 21, 2024 2:34 pm

Joao

Gracias, si funciona, pero se demora casi un 20% mas que poniendo el HB_GcAll() dentro del If Z...

Cambie de antivirus , estoy probando AVG, hasta el momento bien

Saludos y gracias por responder
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1650
User avatar
Adolfo
 
Posts: 846
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: Ayuda con Mensaje Error irrecuperable 9009: hb_xrealloc

Postby karinha » Thu Mar 21, 2024 3:06 pm

Entonces, ponga:

Code: Select all  Expand view

   HB_GcAll( .F. )  // solo si tengo basura se dispara.
 


Y ponga un DELAY para retrasar el LOOPING y evitar la explosión de la memoria RAM.

Pruebe, pls.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7213
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 65 guests