Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!mcnc!decvax!ucbvax!ucbcad!zen!cordelia.berkeley.edu!c164-1bj From: c164-1bj@cordelia.berkeley.edu (Jonathan Dubman) Newsgroups: comp.sys.amiga Subject: Dynamic Stack Allocation Message-ID: <4585@zen.berkeley.edu> Date: Sun, 25-Oct-87 18:10:25 EST Article-I.D.: zen.4585 Posted: Sun Oct 25 18:10:25 1987 Date-Received: Tue, 27-Oct-87 05:37:13 EST Sender: news@zen.berkeley.edu Reply-To: c164-1bj@cordelia.berkeley.edu (Jonathan Dubman) Organization: University of California, Berkeley Lines: 18 I have a speedy maze program I wrote in C that I want to send to Fred and post here, but it needs a large stack. Maximum resolution requires about 150K of stack space. (Massive recursion.) I don't want everybody who runs it without reading the docs first to crash their machine. Is it possible in a C program to know how much stack space I have? I can write a short assembly language program if necessary. Is it possible, if the stack is too small, to dynamically allocate stack space? Can I just allocate a big chunk of memory, reset the stack pointer to there, and deallocate it at the end, resetting the stack pointer to the original stack that never went away? The least I can do is say, "Reset your stack size and run me again.". If I run it from workbench, WB will allocate the stack of the proper size, provided the .info file is correct. CLI is the problem. *&Jonathan Dubman