Is the most likely cause of an Error 28 - "Out of stack space" error an infinite or very deep recursion that is using up too much stack memory?
What are the other likely causes?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your error is described over here in MSDN.
Note: This MSDN article is related to Visual Studio 2005. But it’s likely to say that the same limits are for VB6.
[update]
You can find the Visual Studio 6 (VB6) article over here.
Check that procedures aren’t nested too deeply. This is especially true with recursive procedures, that is, procedures that call themselves. Make sure recursive procedures terminate properly. Use the Calls dialog box to view which procedures are active (on the stack).
Try declaring some variables at the module level instead. You can also declare all variables in the procedure static by preceding the Property, Sub, or Function keyword with Static. Or you can use the Static statement to declare individual Static variables within procedures.
Fixed-length strings in a procedure are more quickly accessed, but use more stack space than variable-length strings, because the string data itself is placed on the stack. Try redefining some of your fixed-length strings as variable-length strings. When you declare variable-length strings in a procedure, only the string descriptor (not the data itself) is placed on the stack. You can also define the string at module level where it requires no stack space. Variables declared at module level are Public by default, so the string is visible to all procedures in the module.
Use the Calls dialog box to view which procedures are active on the stack.
An event cascade is caused by triggering an event that calls an event procedure that’s already on the stack. An event cascade is similar to an unterminated recursive procedure call, but it’s less obvious, since the call is made by Visual Basic rather than by an explicit call in your code. Use the Calls dialog box to view which procedures are active (on the stack).