Mail Archives: djgpp/1996/07/02/11:46:24
> Yes, I see the point, thanks for the flag, I'll use it. Has this behaviour
> changed because of the new ANSI standard ?
The behavior changed because when I wrote the V2 memory management, I wanted
it to be faster than V1.x ... purely a performance issue. Code which assumes
memory is zeroed is buggy and not very portable, so it's reasonable to
expect this code to be fixed. But there is a bunch of it out there, and
not as many programming hours as we would like, so the crt0 flag allows you
to have a "compatible" but slow behavior. The V1.x malloc() code and
the edebug/fsdb debugger symbol code both expected memory zeroing, so
bad coding practices hit the developers too :-)
The speed difference isn't very noticeable on small memory programs, but
if you are working with virtual memory, the extra modification of each
page can double the number of page faults in initialization and force
smart memory managers to commit a page when one really isn't needed
(for the stack and the power of 2 malloc'ing extra, for example).
So for maximum compatibility (with V1.x and unix) you want to zero memory
and use the unixy sbrk() algorithm - but these might not be the best things
for the optimal port.
- Raw text -