This code generate a memory error when the memory allocated is close to 140 mega if I compile it with FWH + xHarbour.com
If i compile the same code with FWH + xHarbour.org the error is generated when the memory allocated is close to 2 giga (size of the ram available in the pc).
If i compile the code with xHarbour.com without FWH the error is generated at 2 giga too.
- Code: Select all Expand view
#include "Fivewin.ch"
#include "HBClass.ch"
PROC Main()
LOCAL aObj := Array(1000000)
LOCAL n := 0
LOCAL oDlg, oGet, oButton
DEFINE DIALOG oDlg
@ 1, 1 GET oGet VAR n SIZE 80, 10
@ 2, 1 BUTTON oButton PROMPT "Start" SIZE 80, 8 ACTION Button1_Click(@aObj,oGet)
ACTIVATE DIALOG oDlg CENTER
aSize(aObj,0)
RETURN
FUNC Button1_Click(aObj,oGet)
LOCAL nTot := Len(aObj)
LOCAL n := 0
FOR n := 1 TO nTot
aObj[n] := OggettoProva():Init()
oGet:SetText("Object in memory: " + lTrim(Str(n)))
SysRefresh()
NEXT
RETURN
CLASS OggettoProva
DATA _Array1 AS ARRAY INIT aFill(Array(12),1)
DATA _Array2 AS ARRAY INIT aFill(Array(12),1)
DATA _Array3 AS ARRAY INIT aFill(Array(12),1)
DATA _Array4 AS ARRAY INIT aFill(Array(12),1)
DATA _Array5 AS ARRAY INIT aFill(Array(12),1)
DATA _Array6 AS ARRAY INIT aFill(Array(12),1)
DATA _Array7 AS ARRAY INIT aFill(Array(12),1)
DATA _Array8 AS ARRAY INIT aFill(Array(12),1)
DATA _Array9 AS ARRAY INIT aFill(Array(12),1)
DATA _Array10 AS ARRAY INIT aFill(Array(12),1)
CONSTRUCTOR Init
METHOD End
DESTRUCTOR Destroy
ENDCLASS
METHOD Init() CLASS OggettoProva
RETURN Self
METHOD End() CLASS OggettoProva
::_Array1 := NIL
::_Array2 := NIL
::_Array3 := NIL
::_Array4 := NIL
::_Array5 := NIL
::_Array6 := NIL
::_Array7 := NIL
::_Array8 := NIL
::_Array9 := NIL
::_Array10 := NIL
RETURN NIL
PROCEDURE Destroy CLASS OggettoProva
::End()
RETURN NIL
This is only a stress test written to understand the problem with my program.
I use FWH 9.04 and xHarbour.com May 2009
Any idea?