This is not correct - or at least far from the whole truth. Apart from return addresses, the stack is also used for allocating local variables for functions called (which incidentally is what makes recursion possible), and I believe also for saving register contents when switching tasks. The latter is not too space-consuming, but if lots of local data is used, the stack can quickly grow very large indeed. A way to avoid this can be to allocate the required data space dynamically and only store pointers to it as local variables.danbeaver wrote:The stack is not memory used by the program for executing instructions or data, it is an area of memory set aside to keep track of "the stack;" the area of memory where addresses are stored when a program calls a subroutine.
This is nothing special for AmigaOS, it is - to the best of my knowledge - the usual way in most OSs and programming languages.And if the Amiga uses its stack differently than the rest of the world, please help out my poor brain cells.
Partly.danbeaver wrote:My point was that arbitrarily increasing, by let's say, doubling the stack because it makes one feel "warm-and-fuzzy" just allocates memory that does not help function. Or is that the wrong assumption?
Users browsing this forum: No registered users and 2 guests