Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!snorkelwacker.mit.edu!hsdndev!cmcl2!adm!news From: dm2368@eecs1.eecs.usma.edu (Fichten Mark CPT) Newsgroups: comp.lang.pascal Subject: Re: How to go over Stack Message-ID: <27191@adm.brl.mil> Date: 13 Jun 91 13:04:43 GMT Sender: news@adm.brl.mil Lines: 66 Robert Oliver writes: > Hi, > Has anyone out there been over 65520 in stack and had the program work? > I need to know how to get over the stack limit. Sence the pointer will not > work right. Is there something wrong with this statement ? > > Testing : Array[1..220] of ^Test; {Test is a Type Record} > > and calling the data with Testing[Index]^.Whois ??? > > Is there something wrong with this ? This will work fine IF you 'attach' a record to each element of the array like this: for i:=1 to 220 do begin New(Testing[i]); { Initialize the fields of your record here... } Testing[i]^.Next := nil; end; This loop will set you up a structure like the following: ARRAY Records TESTING |-------| --------- | 1 |----->| |--nil |-------| --------- --------- | 2 |--------------->| |--nil |-------| --------- | . | | . | | . | |-------| --------- | 218 |----->| |--nil |-------| --------- --------- | 219 |--------------->| |--nil |-------| --------- --------- | 220 |----->| |--nil |-------| --------- The loop allocates memory OFF OF THE HEAP, NOT THE STACK. Assuming that you have not decreased the size of the heap with a compiler directive, or used up most of your heap, this should work fine. Remember to deallocate all the memory if you are finished with the array and the program does other things. A loop like the following will work: for i:=1 to 220 do Dispose(Testing[i]); This will free all the memory ONLY if you have not 'attached' any other nodes on the ends of the records. I'll leave any more complex disposal loop to you! Hope this helps. ____________________________________________________________________________ CPT Mark Fichten | INTERNET: fichten@eecs1.eecs.usma.edu | Captain U.S. Army | @trotter.edu:dm2368@eecs1.eecs.usma.edu | Work: (914) 938-5580 | USENET: rutgers.edu!trotter!eecs1!dm2368 | | harvard.edu!trotter!eecs1!dm2368 | ____________________________________________________________________________