Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!mit-eddie!bu-cs!bucsb.bu.edu!madd From: madd@bucsb.bu.edu.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re: Turbo Pascal : Need more variable space Message-ID: <767@bucsb.bu.edu.UUCP> Date: Tue, 24-Feb-87 00:03:39 EST Article-I.D.: bucsb.767 Posted: Tue Feb 24 00:03:39 1987 Date-Received: Thu, 26-Feb-87 23:22:53 EST References: <2941@vrdxhq.UUCP> Reply-To: madd@bucsb.bu.edu.UUCP (Jim "Jack" Frost) Organization: ODO (Organization for the Disorganization of Organization) Lines: 55 Keywords: turbo, pascal, variable, memory In article <2941@vrdxhq.UUCP> bisanabi@vrdxhq.UUCP (Paul Paloski) writes: > >I have a program written in Turbo Pascal which can't compile because >of variable space required. Some of my variables are quite large. >For example, a 27x27x27 array of reals takes about 39K. I also have >vectors of this array. Is there any way for me to increase the size >of the variable space in Turbo ?? This is basically a kludge, but it does work. The way to do it is to make your arrays some kind of type, like "arraytype". Then make a type which is a pointer to "arraytype". Then use the new() function to get a pointer to an array of that size from the heap. To reference the array, you'll need to give a ^ symbol between the array name and the subscript. A simple example follows, which allocates several large arrays (more than 64k): program largearrays; type arraytype = array[0..32000] of real; { define type of array } arrayptr = ^arraytype; { define pointer to that type } var a1,a2,a3,a4,a5 : arrayptr; { define pointers to several large arrays } begin new(a1); { get space for each array } new(a2); new(a3); new(a4); new(a5); for i:= 0 to 32000 do begin { clear all of the arrays } a1^[i]:= 0.0; a2^[i]:= 0.0; a3^[i]:= 0.0; a4^[i]:= 0.0; a5^[i]:= 0.0; end; { put anything else you want in here } end. It's too bad Turbo Pascal can't use more than 64K of data, but at least it allows you to tap the full memory of your pc by allocating it via pointers. Of course, if your pc doesn't have that much memory, the new() allocation fails and your program will die horribly. Hope this helps. It's the simplest solution I've yet come up with. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - Jim Frost * The Madd Hacker - UUCP: ..!harvard!bu-cs!bucsb!madd | ARPANET: madd@bucsb.bu.edu CSNET: madd%bucsb@bu-cs | BITNET: cscc71c@bostonu -------------------------------+---+------------------------------------ "Oh beer, oh beer." -- Me | [=(BEER) <- Bud the Beer (cheers!)