FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour hb_xgrab can't allocate memory
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
hb_xgrab can't allocate memory
Posted: Fri Oct 17, 2025 03:55 PM
Buenas tardes Enrico, ¿podrías explicarme por qué este simple ejemplo explota la memoria en xHarbour?

Good afternoon Enrico, could you please explain why this simple example explodes the memory in xHarbour?
// C:\FWH\SAMPLES\REALOC.PRG

#include "FiveWin.ch"

static oWnd

FUNCTION Main()

   LOCAL oBar

   DEFINE WINDOW oWnd TITLE "Explode Memoria en 8 gbs Windows 10"

   DEFINE BUTTONBAR oBar _3D OF oWnd

   DEFINE BUTTON OF oBar ACTION XB_REALOCC()

   SET MESSAGE OF oWnd TO "Explode Memoria en 8 gbs Windows 10" NOINSET CLOCK DATE KEYBOARD

   ACTIVATE WINDOW oWnd

RETURN NIL

FUNCTION XB_REALOCC()

   LOCAL cString := "", i, aDados := {}

   hb_gcAll( .F. )

   FOR I := 1 TO 550000 // 1000000

      SYSREFRESH()

      cString += "Mais Dados Aqui"

      AADD( aDados, { i, { i, cString } } )

   NEXT

   XBROWSE( cString )

RETURN NIL

// FIN / END
Gracias, tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: hb_xgrab can't allocate memory
Posted: Sat Oct 18, 2025 08:51 AM

Same error with Harbour, so the problem is probably that you are trying to allocate too much memory.

Continue the discussion