Page 1 of 1

Ayuda con Mensaje Error irrecuperable 9009: hb_xrealloc

PostPosted: Wed Mar 20, 2024 7:40 pm
by Adolfo
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

Re: Ayuda con Mensaje Error irrecuperable 9009: hb_xrealloc

PostPosted: Thu Mar 21, 2024 1:04 am
by Adolfo
Encontre el error

Deshabilite el Avast Antivirus y funciona de maravilla

Re: Ayuda con Mensaje Error irrecuperable 9009: hb_xrealloc

PostPosted: Thu Mar 21, 2024 12:12 pm
by karinha
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.

Re: Ayuda con Mensaje Error irrecuperable 9009: hb_xrealloc

PostPosted: Thu Mar 21, 2024 2:34 pm
by Adolfo
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

Re: Ayuda con Mensaje Error irrecuperable 9009: hb_xrealloc

PostPosted: Thu Mar 21, 2024 3:06 pm
by karinha
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.