Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How large can I set Stacksize?
Message
From
28/10/2022 21:30:23
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01685149
Message ID:
01685176
Views:
35
>>Hi Jeff,
>>
>>VFP needs 554 bytes per stacksize to save some STACKINFO data, for example,
>>stacksize=65000,
>>it needs 554 * 65000 = 36010000, it's about 36MB.
>>
>>Please refer to:
>>http://baiyujia.com/vfpdocuments/f_vfp9fix234.asp
>>[NEW.....] VFP 9.0 FIX - SYS(9116) RETURNS THE STRUCTURE NESTING LEVEL
>>
>> In Visual FoxPro 9.0 and earlier versions, the default value is 128 for the STACKSIZE term in the configuration file,
>> so the Maximum # of nested structured programming commands is 384 (0x42 * 0x80 / 0x16 = 0x180 = 384).
>> In Visual FoxPro Advanced, the default value is 2048 for the STACKSIZE term in the configuration file,
>> so the Maximum # of nested structured programming commands is 6144 (0x42 * 0x800 / 0x16 = 0x1800 = 6144).
>>
>>Best regards,
>>Chen
>
>Chen, if I use the maximum of 64,000 will it immediately allocate the 36MB of memory or is that a limit of what it will use?
>
>Is there more harm to have not enough stack or is it worse to have too much? We want to stop these stack errors.

I've only seen them a few times, but every instance I've seen with stack overflow/nesting errors was ultimately caused by buggy recursive code - either:
- Code that was meant to be recursive but was not well written or hit unexpected edge/corner cases
- Code that was not meant to be recursive but was involved in an extended or inadvertently infinite loop

I've been elbows-deep in VFP frameworks that have used multi-level subclassing at the product and individual client level, and never come close to the default VFP nesting limits.

I recommend looking more deeply into possible causes (assuming you're able to review underlying code), rather than throwing more STACKSIZE resources at the symptoms.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform