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: Ioannis V. <no...@ho...> - 2002-05-13 06:22:00
|
Yes, you can access the rest of memory as "free store". Stack is used to
store the execution path of a program and local objects.
Example. Imagine that you have the code:
void k()
{
int x=1;
f();
int y=g(x);
f();
}
int main()
{
int a=5;
f();
int r=g(a);
k();
}
In the stack the following is stored:
a=5;
pointer to f() call. -> // f() things executed here. When it finishes: |
<-----------------------------------------------------------------------
-------
int r;
pointer to g() call--> // g() things executed here. When it finishes: |
<-----------------------------------------------------------------------
--------
r=some_value
pointer to k() call -->
int x=1;
pointer to f() call ---> //finishes |
<-------------------------------------
int y;
pointer to g() call---> // finishes|
<--------------------------------------
y=some_value
pointer to f() call ---> //finishes |
<-------------------------------------
k() finishes. Automatic local objects in
the stack die |
<-----------------------------------------------------------------------
----------------
main() ends.
Automatic local objects in the stack die
return success indicator
I hope it gives some idea.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf Of staale
> Sent: Monday, May 13, 2002 9:05 AM
> To: Dev-C++ Mailing List
> Subject: Re: [DEV-C++] BUG: Dev-C 4.9.20 consolprogram has
> only access to 1MB memory.
>
>
> Well, I'll hold my horses a bit longer before I cry wolf,
> wolf the next
> time.:o)
>
> As Ioannis has pointed out the different results are
> differences in the
> implementation of the mingw32 compiler. Evolving from
> allowing ca 31MB stack
> space to ca 2MB. Probably to prevent us from cheating?
>
> The following code shows that you have access to all the
> memory your OS will
> give you *S*.
|