Re: [DEV-C++] BUG: Dev-C 4.9.20 consolprogram has only access to 1MB memory.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: staale <st...@le...> - 2002-05-10 07:53:08
|
Hi again Ioannis and Helmut,
Your sample code (yes the application crashes, not the IDE) died (stack
overflow) at Approximately 2002 kB on (Nt4-Sp6 - Dev-C 4.9.20).
On NT4-SP6 Dev-C 4.0 I got 32250 kB before I got a stack overflow error.
The w2k machine with first Dev-C 4.0 and then 4.9.20 installed got the stack
overflow at 2002 kB.
So we could conclude that the two versions of Dev-C (or rather accompanied
compilers) handels stack allocation differently?
Regards
Staale Flock
----- Original Message -----
From: "Ioannis Vranos" <no...@ho...>
To: "Dev-C++ Mailing List" <dev...@li...>
Sent: Friday, May 10, 2002 7:28 AM
Subject: RE: [DEV-C++] BUG: Dev-C 4.9.20 consolprogram has only access to
1MB memory.
>
> > -----Original Message-----
> > From: staale [mailto:st...@le...]
> > Sent: Friday, May 10, 2002 7:55 AM
> > To: Ioannis Vranos; Dev-C++ Mailing List
> > Subject: Re: [DEV-C++] BUG: Dev-C 4.9.20 consolprogram has
> > only access to 1MB memory.
> >
> >
> > Hi Ioannis,
> >
> > As I'm not a seasoned C++ programer I welcom your your work
> > on my code, and
> > your efforts in this mailing list.:o)
> >
> > To be shure I test again and with som simpler code and it
> > still fails on a
> > NT4-Sp6 (and w2k) with Dev-C 4.9.20 (Clean new installation
> > of the computer,
> > also the OS!!)
> >
> > I't works on a NT4-Sp6 with Dev-C 4.0
> >
> > See also the 'tread'
> > [Dev-C++] not enough memory - how to configure Win2000
> > which is the reaason form my involvement.
> >
> > ----------- Code -------------
> > #include <stdlib.h>
> >
> > int main()
> > {
> >
> > // 1MB = 1048576 = 1*1024*1024
> > // 2MB = 2097152 = 2*1024*1024
> > // 31MB = 32505856
> > char narr[2097152];
> >
> > system("PAUSE");
> > return 0;
> > }
> > ----------- Code End -------------
> >
> > Best Regards
> > Staale Flock
>
>
>
> I assume you mean that your code crashes, not the IDE.There is a limit
> of the stack. It has nothing to do with the compiler.
>
>
> Run this code to see the size of your stack:
>
> #include <iostream>
>
> void stack()
> {
> using namespace std;
>
> static unsigned long counter=0;
>
> char buffer[1024-sizeof(unsigned long)-1];
>
> counter++;
>
> cout<<"Allocated approximately "<<counter<<" KB of stack before i
> die\n";
>
> stack();
> }
>
>
>
> int main()
> {
> stack();
> }
>
>
> That's why for large arrays & objects we use the free store (new,
> delete) or better the standard library containers such as vector.
>
>
>
> Ioannis
>
> * Ioannis Vranos
> * Programming pages: http://www.noicys.cjb.net
> * Alternative URL: http://run.to/noicys
>
> _______________________________________________________________
>
> Have big pipes? SourceForge.net is looking for download mirrors. We supply
> the hardware. You get the recognition. Email Us: ban...@so...
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|