From mboxrd@z Thu Jan 1 00:00:00 1970 From: david@kdbarto.org (David) Date: Thu, 10 Sep 2015 13:29:16 -0700 Subject: [TUHS] Did realloc ever zero the new memory? In-Reply-To: <20150910202723.GI8154@mcvoy.com> References: <5962857.12872.1441915841364.JavaMail.root@zimbraanteil> <20150910202115.GH8154@mcvoy.com> <395F25EB-77F3-4830-A1AF-C27E43550C04@kdbarto.org> <20150910202723.GI8154@mcvoy.com> Message-ID: I mentioned the /dev/zero malloc and, no, he was quite sure that it was realloc doing the zero fills. Glad to know that I’m sitting on the right side of history on this one. David > On Sep 10, 2015, at 1:27 PM, Larry McVoy wrote: > > Good, glad to know it wasn't just me. I've finally let my team use it > but we avoided it when we supported more odd ball platforms. > > On zero fill, I doubt many did that. Many really early on when memory > was small. > > What you might be thinking of is modern systems implement malloc() > as an mmap of /dev/zero and the initial data comes through as zeroed. > But counting on that would be a mistake. > > On Thu, Sep 10, 2015 at 01:22:33PM -0700, David wrote: >> Buggy, sure. >> >> Zero (less) filling, that is the question. >> >> Realloc has had a difficult history, and I try to avoid it if at all possible. >> >> David >> >>> On Sep 10, 2015, at 1:21 PM, Larry McVoy wrote: >>> >>> Am I the only one that remembers realloc() being buggy on some systems? > > -- > --- > Larry McVoy lm at mcvoy.com http://www.mcvoy.com/lm