delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/12/09/11:39:57

Date: Sat, 9 Dec 1995 10:03:48 -0500
From: dj (DJ Delorie)
To: A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: decreasing program loadup time

> > ... load times are greatly improved with V2 since ... memory is not zeroed
> > ...
> 
> That looks like stopping a LOT of existing programs from working, which relied
> on unassigned arrays and variables being all zeros at the start!!!

His statement was not quite complete.  Load times are increased
because memory allocated by sbrk() (and thus malloc()) is not zeroed.
Memory in the bss region (uninitialized variables) is zeroed in
accordance with the ANSI specification.

Since many applications initialize themselved by allocating memory to
set up data, the program initialization is much faster.  In fact, the
new sbrk has an option to fill memory with purposefully invalid data
to help you track down cases where you rely on zeroing, which isn't
portable and can lead to subtle bugs.

In the future, please try to understand that we really do know what
we're doing, and we wouldn't be stupid enough to shut off bss zeroing,
since none of the core programs would work either.

DJ

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019