473,378 Members | 1,387 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,378 software developers and data experts.

Debugging stack overflows..

Hi,

I am getting a stack overflow exception. I was wondering how to to debug
this situation with vc.
I know that the problem is not based on (unintended or intended) recursion
and the call stack at the time of the exception is rather small. Thus, there
must be some variable declared on the stack that takes up a lot of memory.
How can I find this? I thought about setting a data-breakpoint in the end of
the stack but I don't know what this address would be.

Søren

Nov 16 '05 #1
3 5130

"Søren Johansen" <so***************@hotmail.com> wrote in message
news:Or**************@TK2MSFTNGP10.phx.gbl...
Hi,

I am getting a stack overflow exception. I was wondering how to to debug
this situation with vc.
I know that the problem is not based on (unintended or intended) recursion
and the call stack at the time of the exception is rather small. Thus, there must be some variable declared on the stack that takes up a lot of memory.
How can I find this? I thought about setting a data-breakpoint in the end of the stack but I don't know what this address would be.


If it's reproducable, just put a breakpoint at the beginning of the function
and track all automatic variables that are created. A class with many value
members can also be a problem.

class {
public:
char a[1000000];
}
Nov 16 '05 #2
> If it's reproducable, just put a breakpoint at the beginning of the
function
and track all automatic variables that are created. A class with many value members can also be a problem.

class {
public:
char a[1000000];
}


Well it is (reproductable), but the final function called does not allocate
major variables. In fact, I don't see any of the functions on the call stack
with any variables of significance. Which is why I think that you are
right - there is a class somewhere that contains some large member. But how
can I track this sort of thing down?
Nov 16 '05 #3
Go into the exceptions menu item under debug and change stack overflow to
stop always. Press run and you should be sitting on the statement that
caused the problem. This is true of all of the various exceptions which can
happen. Just change the exception handling in the debugger to stop always
and you should be there. It is best to change it back after you are done as
not doing so can sometimes be confusing, MS sometimes counts on some
exceptions but in this case you should find the problem quickly. Don't
forget that in many cases you call some MS function with junk and it will
cause the exception not you so look up the stack in that case.

--


Jim

"Søren Johansen" <so***************@hotmail.com> wrote in message
news:Oa*************@TK2MSFTNGP09.phx.gbl...
If it's reproducable, just put a breakpoint at the beginning of the function
and track all automatic variables that are created. A class with many

value
members can also be a problem.

class {
public:
char a[1000000];
}


Well it is (reproductable), but the final function called does not

allocate major variables. In fact, I don't see any of the functions on the call stack with any variables of significance. Which is why I think that you are
right - there is a class somewhere that contains some large member. But how can I track this sort of thing down?

Nov 16 '05 #4

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

Similar topics

4
by: Allen | last post by:
Hi all, What are some different approaches to dealing with stack overflows in C++? I'm especially interested in approaches concerned with speed for infrequent overflows. -- Best wishes,...
13
by: Will Pittenger | last post by:
I have a Control derived class. When the parent of the control changes the control's Location property, the stack overflows. I have not found a way to find out what was on the stack when it does...
19
by: Jim | last post by:
I have spent the past few weeks designing a database for my company. The problem is I have started running into what I believe are stack overflow problems. There are two tab controls on the form...
87
by: CJ | last post by:
Hello: We know that C programs are often vulnerable to buffer overflows which overwrite the stack. But my question is: Why does C insist on storing local variables on the stack in the first...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.