Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!usc!apple!agate!sandstorm.Berkeley.EDU!magid From: magid@sandstorm.Berkeley.EDU (Paul Magid) Newsgroups: comp.lang.pascal Subject: Dynamically allocating space to arrays > 64K Message-ID: <1991Jan9.220530.6557@agate.berkeley.edu> Date: 9 Jan 91 22:05:30 GMT Sender: usenet@agate.berkeley.edu (USENET Administrator) Organization: ucb Lines: 56 First I would like to thank all the people who pointed me in the direction of DDJ article that answered my last question. Below please find the code that I am now using, it is pretty much directly out of the article. I would now like to be able to allocate about 75% of the systems memory to the large data structure. However, I am at a loss for how to do it. As it stands the program either has enough memory to run or it does not, I would like to be able to allocate a fixed proportion of available memory to it. Thank you in advance for your help. Paul ================================================================================ const MAXROWS = 501; {7501} MAXCOLS = 82; type colPtr = ^colArray; colArray = array [1..MAXCOLS] of char; colNode = record cols : colPtr; End; rowPtr = ^rowArray; rowArray = array [1..MAXROWS] of colNode; var Filecont:rowPtr; Procedure create (var D : rowPtr; var error : Boolean); { Create huge array 'D' and pass back pointer to it } Var row : word; Begin Error := false; If maxAvail > sizeof (rowArray) then { if space available } GetMem (D, sizeof (rowArray)) { allocate row array } Else begin D := nil; Error := true; End; If D <> nil then For row := 1 to maxRows do begin { allocate all rows } If not error then If maxAvail > sizeof (colArray) then { if space } GetMem (D^ [row].cols, sizeof (colArray)) { alloc row } Else Error := true; End; End;