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

Stack overflow in vs.net c++ program

I am attempting to port a C code that runs OK on a number of Linux and Unix
machines to Windows XP using Visual Studio C++. I have set the program up as
a console application, but when I try to run it I get a stack overflow:

Unhandled exception at 0x0041e715 in NewMD.exe: 0xC00000FD: Stack overflow.

The call stack is:

NewMD.exe!_chkstk() Line 91
NewMD.exe!mainCRTStartup() Line 259 +0x19
kernel32.dll!77e814c()

All this appears to be happening before my C code actually does anything.

Does anyone know what the problem is and how to fix it

Thanks
David

Nov 17 '05 #1
2 2867
On Mon, 12 Jul 2004 02:05:01 -0700, David W. Walker wrote:
I am attempting to port a C code that runs OK on a number of Linux and Unix
machines to Windows XP using Visual Studio C++. I have set the program up as
a console application, but when I try to run it I get a stack overflow:

Unhandled exception at 0x0041e715 in NewMD.exe: 0xC00000FD: Stack overflow.

The call stack is:

NewMD.exe!_chkstk() Line 91
NewMD.exe!mainCRTStartup() Line 259 +0x19
kernel32.dll!77e814c()

All this appears to be happening before my C code actually does anything.

Does anyone know what the problem is and how to fix it


It could be the allocation of some very large object. For example, a static
class variable that is very large. If the stack space is smaller for your
windows program than your unix program, the variable might not fit. Either
increase stack size or allocate such objects dynamically (i.e. on the
heap).

--
Daniel
Nov 17 '05 #2
There are number of reasons for stack overflow exception. As Daniel pointed,
program (a function??) could be allocating a very large stack space.Or,

- You are copying something to a variable on the stack, and buffer exceeds
bounds of the stack
- You are recursively calling a function and that never ends
- Incorrect function pointer casting

These are all I can think right now.
"Daniel Lidström" <so*****@microsoft.com> wrote in message
news:1p******************************@40tude.net.. .
On Mon, 12 Jul 2004 02:05:01 -0700, David W. Walker wrote:
I am attempting to port a C code that runs OK on a number of Linux and Unix machines to Windows XP using Visual Studio C++. I have set the program up as a console application, but when I try to run it I get a stack overflow:

Unhandled exception at 0x0041e715 in NewMD.exe: 0xC00000FD: Stack overflow.
The call stack is:

NewMD.exe!_chkstk() Line 91
NewMD.exe!mainCRTStartup() Line 259 +0x19
kernel32.dll!77e814c()

All this appears to be happening before my C code actually does anything.
Does anyone know what the problem is and how to fix it
It could be the allocation of some very large object. For example, a

static class variable that is very large. If the stack space is smaller for your
windows program than your unix program, the variable might not fit. Either
increase stack size or allocate such objects dynamically (i.e. on the
heap).

--
Daniel

Nov 17 '05 #3

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

Similar topics

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...
4
by: Peter | last post by:
My program causes StackOverflow because it makes many recursive calls due to the program's nature (not a bug!). I would like to know if there is any settings in the compiler or VS.NET IDE so that...
0
by: Howard Kaikow | last post by:
I recently discovered http://msdn.microsoft.com/library/en-us/vclib/html/vclrf_resetstkoflw.asp, which states: "The _resetstkoflw function recovers from a stack overflow condition, enabling a...
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'...
24
by: John | last post by:
I know this is a very fundamental question. I am still quite confused if the program call stack stack should always grows upwards from the bottom, or the opposite, or doesn't matter?? That means...
7
by: amit.atray | last post by:
Environement : Sun OS + gnu tools + sun studio (dbx etc) having some Old C-Code (ansi + KR Style) and code inspection shows some big size variable (auto) allocated (on stack) say for ex. char...
12
by: Geoff Cox | last post by:
Hello, Some one is getting the "stack overflow" error message when using a Javascript program which I wrote when using Internet Explorer but not when using Mozilla. Any ideas as to how I...
3
by: jack113256 | last post by:
Hi everyone: I have a question in using Callback function, there is my code: /******* code start *********/ #include <stdio.h> void a(); void b(); void run();
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: 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:
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.