F
Flash Gordon
Nishu wrote, On 07/02/07 11:12:
The OP asked about variables declared static in functions, globals, and
automatic variables, so that is what I focused on.
I stated it could be not that it is on any current system. Others stated
that it was declared on the heap, which depending on the definition of
heap I would dispute, and one person at least agreed I had a point.
If that is your definition of heap then by definition *alloc/free use a
heap ;-)
Actually, my usage of the word heap corresponds with yours which is why
I said that static/global data is not stored on the heap in my
experience. However, I can conceive of a system effectively using
malloc/calloc to allocate space for statics/globals before calling main,
just as I can conceive of the space being allocated on a stack calling main.
You may be right about static/global allocation.
The OP asked about variables declared static in functions, globals, and
automatic variables, so that is what I focused on.
> It is placed in zero-
initialized region which can be defined in any part of memory(but
rarely(or never?) on memory which is stack) but,
I stated it could be not that it is on any current system. Others stated
that it was declared on the heap, which depending on the definition of
heap I would dispute, and one person at least agreed I had a point.
> AFAIK, dynamic memory
allocations are termed as heap which must be freed before execution
gets over. (i.e, alloc/malloc/realloc)
If that is your definition of heap then by definition *alloc/free use a
heap ;-)
Actually, my usage of the word heap corresponds with yours which is why
I said that static/global data is not stored on the heap in my
experience. However, I can conceive of a system effectively using
malloc/calloc to allocate space for statics/globals before calling main,
just as I can conceive of the space being allocated on a stack calling main.