public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* 2 questions
@ 2007-02-12 17:42 Michael Gong
  2007-02-12 19:21 ` Andrew Haley
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Gong @ 2007-02-12 17:42 UTC (permalink / raw)
  To: gcc-help

Hi, all,

They are not related with gcc. But since gcc's developers are all 
experienced developers and willing to help, I would like to post my 
questions here.

1. when is the local static variable of a function get allocated ? Is it 
during the system startup or when the function is called ?

2. where does the memory used by malloc() come from ? I know they are 
from heap. So what's the memory of heap come from ?


Thanks.

Mike

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 2 questions
  2007-02-12 17:42 2 questions Michael Gong
@ 2007-02-12 19:21 ` Andrew Haley
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Haley @ 2007-02-12 19:21 UTC (permalink / raw)
  To: Michael Gong; +Cc: gcc-help

Michael Gong writes:

 > They are not related with gcc. But since gcc's developers are all 
 > experienced developers and willing to help, I would like to post my 
 > questions here.

OK, but please don't overdo it.

 > 1. when is the local static variable of a function get allocated ? Is it 
 > during the system startup or when the function is called ?

It's allocated by the compiler, at compile time, long before the
program is even started.

 > 2. where does the memory used by malloc() come from ? I know they are 
 > from heap. So what's the memory of heap come from ?

There are two ways, the old and the new.

The old is via sbrk(2).  Ths extends the data segment of a program.

The new is via mmap(2).  mmap("/dev/zero", len) allocates zeroed pages
of memory.

The man pages tell you how to use these.

Andrew.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 2 questions
@ 2006-01-13 12:03 gumbold
  0 siblings, 0 replies; 3+ messages in thread
From: gumbold @ 2006-01-13 12:03 UTC (permalink / raw)
  To: gcc-help

Hi

i have gcc 4.0.2 on FC4 and playing w/ specs file.
there are number of questions that i want to ask:

1. how to change name of cc1 binary?

2. what is behaviour of `--no-integrated-cpp' option?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-12 17:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-12 17:42 2 questions Michael Gong
2007-02-12 19:21 ` Andrew Haley
  -- strict thread matches above, loose matches on Subject: below --
2006-01-13 12:03 gumbold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).