This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE:size limit for static arrays in cygwin/gcc


At 12:55 2003-02-17, Danny Smith wrote:
Randall R Schulz <rrschulz at cris dot com>  wrote:

> A couple of months ago, someone reported on how local (stack)
> allocations larger than a certain threshold were allocated on the heap.
> In fact, you, Danny, contributed materially to that thread: Subject
> "Strange behaviour of gcc" starting with a posting by
> on Dec. 24, 2002.

No that's not quite right:

Stack allocations larger than one page (4KB) cause gcc to probe the stack.
The allocation is still static
I was clearly confused about what "alloca" does: It allocates space on the stack, _not_ on the heap, as I thought.

However, there must be a terminological issue here, because I would describe what alloca does as _dynamic_ stack-resident allocation. It is dynamic because it happens as a result of a run-time call. I understand static to mean an action (allocation, binding, computation, etc.) that is handled entirely at compile and / or link time.

I think, also, the stack probe is automatically called in main, to force
alignment of stack to a page boundary.



Randall Schulz

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]