473,320 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

stack depth problem

PJ6
I have an algorithm that processes data recursively. When I'm testing it
works fine, but when I feed it data from the actual application, I get
"stack overflow". What bothers me is that the data my recursive processor is
seeing in production is identical to the test data; the only difference is
that now the processor must go deeper into an object model to get the values
with which it is working. I trace things through, there is no out of control
recursion. I've never seen this before, but the stack just craps out on a
legitimate path of execution. Not enough room. Before I rewrite my
processor, I'd like to know, is there a way of increasing stack depth?

I'm probably going to have dump the recursion since data can change... so
this question is more academic than anything else.

Paul
Mar 25 '07 #1
2 3016
"PJ6" <no***@nowhere.netwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>I have an algorithm that processes data recursively. When I'm testing it
works fine, but when I feed it data from the actual application, I get
"stack overflow". What bothers me is that the data my recursive processor
is seeing in production is identical to the test data; the only difference
is that now the processor must go deeper into an object model to get the
values with which it is working. I trace things through, there is no out of
control recursion. I've never seen this before, but the stack just craps
out on a legitimate path of execution. Not enough room. Before I rewrite my
processor, I'd like to know, is there a way of increasing stack depth?
Yes, there is. You can use the STACKSIZE in a module definition file or the
/STACK:n where n is the size in bytes of the maximum amount of stack you
expect to use.

Regards,
Will
Mar 25 '07 #2
PJ6 wrote:
I have an algorithm that processes data recursively. When I'm testing
it works fine, but when I feed it data from the actual application, I
get "stack overflow". What bothers me is that the data my recursive
processor is seeing in production is identical to the test data; the
only difference is that now the processor must go deeper into an
object model to get the values with which it is working. I trace
things through, there is no out of control recursion. I've never seen
this before, but the stack just craps out on a legitimate path of
execution. Not enough room. Before I rewrite my processor, I'd like
to know, is there a way of increasing stack depth?
I'm probably going to have dump the recursion since data can
change... so this question is more academic than anything else.
You can increase the stack size for any threads that you create by passing a
larger stack size to CreateThread (or _beginthreadex). For the main entry
point of the application, you can increase the stack size using the linker
option /STACK:size_in_bytes when the EXE is linked (or with the STACKSIZE
directive in a .DEF file, or by using EDITBIN on the EXE after linking).
Note that if you're not building the EXE, the only recourse you have is to
create a new thread with the larger size.

I'd agree though - if you're using up a 1Mb stack, you probably need to
think about a non-recursive approach.

-cd


Mar 25 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Andrew | last post by:
Last night I was reading about implementing my own stack. The example given pushes items on and off the stack at the start and end of each procedure (ie. in a std module). What's not so clear is...
4
by: chandra.somesh | last post by:
I recently was having trouble converting implementaion of recursions using stack. While single level of recursions are quite intuitive , it is when we have more than one recursive calls in the...
3
by: alanwo | last post by:
For recursive search for files, like http://support.microsoft.com/default.aspx?scid=KB;EN-US;306666, it may lead to "out of stack" error if searching too many files, say millions of files. Do you...
13
by: Ben R. Bolton | last post by:
The documentation indicates that the threads "default stack size" is 1MB. The work "default" implies that it can be changed. Is it possible to change the StackSize in .NET? If so how? Is it...
2
by: 63q2o4i02 | last post by:
Hi, I've written a top-down recursive decent parser for SPICE circuit descriptions. For debugging purposes, I wanted each production rule/function to know what its own name was, so at the...
6
by: Daz | last post by:
Hi everyone! It is indeed, once again time for me to ask another stupid question. I have been searching around on the net for quite a while, and can't find anything that explains 'exactly'...
6
by: Tony | last post by:
Is there any value to pursuing program designs that mimimize the mainline call stack? For example, within main() I could code up something like: while(GetMsg(m)) DispatchMsg(m); instead of...
13
by: softwaredoug | last post by:
I can't see to easily find this on google or in a newsgroup Is there a standard function/macro/whatever you can call and determine the distance in a C program how deep one is in the C call stack...
3
by: Martin Manns | last post by:
Hi, Calling methods of other object instances seems quite expensive on the stack (see example below). Is there a better way of traversing through methods of instances that are connected in a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.