When I ported OI to a few dozen OSes back in the early 1990s,
realloc behaved correctly. We used it in the pre-template / STL
days of C++ to implement variable length arrays. Any misbehavior
predated this.
The systems were HP/UX, AIX, AUX, OSF/1 (Digital Unix), SunOS 4,
Solaris, Linux, FreeBSD, IRIX, and Apollo's Unix.
Warner
On Fri, Sep 11, 2015 at 12:21 AM, Rudi Blom <rudi.j.blom(a)gmail.com> wrote:
I never used realloc(), only malloc() and calloc().
Checking a few unixes I have access to all reallocs() seem to state
either nothing on contents of memory added or state explicitly
'undefined'.
The only function which zeroes allocated memory is calloc() it seems.
Unixes checks: SCO UNIX 3.2V4.2, Digital Unix 4.0G, Tru64 Unix V5.1B,
HP-UX 11.23, HP-UX 11.31
Cheers
On 9/11/15, tuhs-request(a)minnie.tuhs.org <tuhs-request(a)minnie.tuhs.org>
wrote:
Send TUHS mailing list submissions to
tuhs(a)minnie.tuhs.org
To subscribe or unsubscribe via the World Wide Web, visit
https://minnie.tuhs.org/mailman/listinfo/tuhs
or, via email, send a message with subject or body 'help' to
tuhs-request(a)minnie.tuhs.org
You can reach the person managing the list at
tuhs-owner(a)minnie.tuhs.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of TUHS digest..."
Today's Topics:
1. Did realloc ever zero the new memory? (David)
2. Re: Did realloc ever zero the new memory? (Jim Capp)
3. Re: Did realloc ever zero the new memory? (David)
4. Re: Did realloc ever zero the new memory? (Larry McVoy)
5. Re: Did realloc ever zero the new memory? (David)
6. Re: Did realloc ever zero the new memory? (Larry McVoy)
7. Re: Did realloc ever zero the new memory? (Clem Cole)
8. Re: Did realloc ever zero the new memory? (Dave Horsfall)
----------------------------------------------------------------------
Message: 1
Date: Thu, 10 Sep 2015 12:52:45 -0700
From: David <david(a)kdbarto.org>
To: tuhs(a)minnie.tuhs.org
Subject: [TUHS] Did realloc ever zero the new memory?
Message-ID: <E798E102-2C50-4AB2-92CC-188D05AA951F(a)kdbarto.org>
Content-Type: text/plain; charset=utf-8
I?ve just had a discussion with my boss about this and he claimed that it
did at one point and I said it hasn?t in all the unix versions I?ve ever
played with (v6, v7, sys III, V, BSD 2, 3, 4, SunOS and Solaris).
My question to this illustrious group is: Did any Unix or Unix like OS
ever
zero fill on realloc?
David
------------------------------
Message: 2
Date: Thu, 10 Sep 2015 16:10:41 -0400 (EDT)
From: Jim Capp <jcapp(a)anteil.com>
To: david(a)kdbarto.org
Cc: tuhs(a)minnie.tuhs.org
Subject: Re: [TUHS] Did realloc ever zero the new memory?
Message-ID: <5962857.12872.1441915841364.JavaMail.root@zimbraanteil>
Content-Type: text/plain; charset="utf-8"
On every system that I've ever used, I believe that realloc did not do a
zero fill. There might have been a time when malloc did a zero fill, but
I
never counted on it. I always performed a memset
or bzero after a malloc.
I'm pretty sure that I counted on realloc to NOT perform a zero fill.
$.02
From: "David" <david(a)kdbarto.org>
To: tuhs(a)minnie.tuhs.org
Sent: Thursday, September 10, 2015 3:52:45 PM
Subject: [TUHS] Did realloc ever zero the new memory?
I?ve just had a discussion with my boss about this and he claimed that it
did at one point and I said it hasn?t in all the unix versions I?ve ever
played with (v6, v7, sys III, V, BSD 2, 3, 4, SunOS and Solaris).
My question to this illustrious group is: Did any Unix or Unix like OS
ever
> zero fill on realloc?
>
> David
>
> _______________________________________________
> TUHS mailing list
> TUHS(a)minnie.tuhs.org
>
https://minnie.tuhs.org/mailman/listinfo/tuhs
>