Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ames!ucbcad!ucbvax!decvax!decwrl!pyramid!oliveb!intelca!mipos3!cpocd2!rod From: rod@cpocd2.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re: help in turbo pascal Message-ID: <552@cpocd2.UUCP> Date: Thu, 2-Apr-87 18:41:46 EST Article-I.D.: cpocd2.552 Posted: Thu Apr 2 18:41:46 1987 Date-Received: Sun, 5-Apr-87 03:08:24 EST References: <10629@topaz.RUTGERS.EDU> Reply-To: rod@cpocd2.UUCP (Rod Rebello) Organization: Intel, Santa Clara, CA Lines: 32 In article <10629@topaz.RUTGERS.EDU> whoffman@topaz.UUCP writes: > >hello, > > This is a question for all you turbo pascal users out there. any >help (if i can be helped) would be appreciated. while running a turbo >program that makes extensive recursive calls i stumble upon a runtime >error "ff" which evidentily means i have a stack heap collision >according to the manual. is there any way to overcome this problem >without removing the recursion? (it isnt neccessarily a recursive call >that fails, sometimes its just a call to another procedure from within >a recursive call) . Thanks again for the info... > The "heap" is where memory is allocated for such things as pointers, records, etc. This gets eaten up with calls to allocate new records using the "new" procedure. The "stack" is where Turbo allocates memory for temporarily storing (pushing) the variables used within your recursive procedure prior to calling itself, so that they can be restored upon re-entering (poping) the procedure from that call. These two areas are at opposite ends of memory and 'grow' towards each other as space is allocated. The collision occurs when they meet. The only way I know of to prevent this is to limit the number of recursive calls, or if possible, reduce the amount of heap required by reducing NEW calls. Also try to reduce the number and size of variables that have to be saved before each recursive call. -- Rod Rebello ...!intelca!mipos3!cpocd2!rod