Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Sep 1996 17:52:49 +0200 (MET DST)
From:      guido@gvr.win.tue.nl (Guido van Rooij)
To:        dyson@FreeBSD.org
Cc:        FreeBSD-hackers@FreeBSD.org
Subject:   Re: stack
Message-ID:  <199609281552.RAA05940@gvr.win.tue.nl>
In-Reply-To: <199609281550.KAA01258@dyson.iquest.net> from "John S. Dyson" at "Sep 28, 96 10:50:32 am"

next in thread | previous in thread | raw e-mail | index | archive | help
John S. Dyson wrote:
> > When I allocate something on the stack, isn't it supposed to be completely
> > zero?
> > like:
> > main(int argc, char **argv) {
> > 	char buf[1000];
> > 
> > ...
> > }
> > 
> > Then buf should be zero, or am I missing something here?
> > 
> The first time that you use a page the kernel will demand zero it.  But
> if you have used the stack space before, it will be whatever you left in
> it.

I used exactly this program:
main() {
	char buf[1000];

	write(1, buf, 1000);
}

The resulting file did not conatin only zero's. I think this is weird.
This is on a 2.1.5R system

-Guido



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609281552.RAA05940>