Do COMMON SHARED variables take up stack space?
Do COMMON SHARED variables take up stack space?
(OP)
Hey everyone, I'm running into the OUT OF STACK SPACE error. I know what the error means and what the stack is, but I'm curious what I can do to clean up some space without using CLEAR (which is not an option by any means). I have a LOT of COMMON SHARED variables that pass between several modules in my game, such as MAIN.BAS, STATUS.BAS, FIGHT.BAS, etc... Do these COMMON SHARED variables take up stack space for every sub I go into?
RE: Do COMMON SHARED variables take up stack space?
And the statement "To work around this problem, dimension the TYPEd array with DIM SHARED or put it in a COMMON SHARED statement" from the following KB implies that COMMON SHARED does not use the stack: http://support.microsoft.com/kb/57711
RE: Do COMMON SHARED variables take up stack space?
COMMON SHARED variables take up space before every other SUB or FUNCTION.
If you do
COMMON SHARED x(1000) as string
or just
DIM SHARED x(1000) as string
then the amount of storage needed to support that array will be unavailable to all SUB's and FUNCTION's or even MAIN even if the array is never used.
Does that answer your question?
Mac
RE: Do COMMON SHARED variables take up stack space?