473,793 Members | 2,742 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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!_chks tk() Line 91
NewMD.exe!mainC RTStartup() Line 259 +0x19
kernel32.dll!77 e814c()

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 2895
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!_chks tk() Line 91
NewMD.exe!mainC RTStartup() Line 259 +0x19
kernel32.dll!77 e814c()

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*****@micros oft.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!_chks tk() Line 91
NewMD.exe!mainC RTStartup() Line 259 +0x19
kernel32.dll!77 e814c()

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
3145
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 (nested), three list views, one tree control with up to 30,000 nodes, maybe 15 comboboxes (half of which have a large recordset as rowsource), 20 or so buttons and around 30 text boxes (not to mention the images, labels, etc and around 1000 lines...
4
360
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 I can increase the stack size to prevent the overflow error. Thanks a lot! Peter http://www.infopx.com
0
914
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 program to continue instead of failing with a fatal exception error. If you don't call _resetstkoflw, there is no guard page after the previous exception and the next time there is a stack overflow there will be no exception at all; the process...
6
2647
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' what a stack overflow is, or how it's detected. I know that it's leterally putting too many objects on the stack, but how many objects can you have on the stack, or do OSs only allow a certain number of recursive calls to functions?
24
6590
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 the stack pointer should go upwards when there are "push" operations, and stack pointer should go downards when there are "pop" operations?? If this is the case, the address should go upwards (increasing) or downards (decreasing) then? i.e....
7
22052
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 a; (this type of code and other complex mallc/free etc is used frequently and total approx 450 files, each file is of approx/avg 1000 line,
12
11838
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 might find out what is happening? Cheers,
3
2899
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
5577
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 place? I can see two definite disadvantages with this: 1) deeply nested recursive calls to a function (especially if it defines
0
9671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10433
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10161
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9035
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4112
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.