Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

Stack Overflow in Visual C++

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gpsabove@gmail.com - 26 Oct 2007 18:00 GMT
I created a C++ program and defined a huge struct. The struct size is
about 10000*100 bytes.

I compiled the program in Borland C++ Builder6 and everything is OK.
However, Visual C++.NET 2003 reported error as "Unhandled exception
at ... Stack overflow". Visual C++ will not report any problem if I
reduce the struct size to a much smaller one. Anybody know how to make
VC++ accept huge struct and not cause stack overflow?
Thank you in advance.

My Struct Sample:
typedef struct
{
double dVarXXX[10000];
}StructYYY;

typedef struct
{
StructYYY myStructYYY[100];
}StructZZZ;
David Lowndes - 26 Oct 2007 21:04 GMT
>I created a C++ program and defined a huge struct. The struct size is
>about 10000*100 bytes.
[quoted text clipped - 4 lines]
>reduce the struct size to a much smaller one. Anybody know how to make
>VC++ accept huge struct and not cause stack overflow?

Allocate it on the heap (use new or malloc) rather than on the stack.

Dave
Johnson Liuis - 26 Oct 2007 22:10 GMT
Yes, it works!

> >I created a C++ program and defined a huge struct. The struct size is
>>about 10000*100 bytes.
[quoted text clipped - 8 lines]
>
> Dave
gpsabove@gmail.com - 26 Oct 2007 23:05 GMT
Yes using new or malloc really helps. Thanks.

> Allocate it on the heap (use new or malloc) rather than on the stack.
>
> Dave

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.