[TUHS] Did realloc ever zero the new memory?

Dave Horsfall dave at horsfall.org
Sun Sep 13 16:09:55 AEST 2015


On Sat, 12 Sep 2015, Larry McVoy wrote:

> That's a really good point.  Anyone like these?
> 
> void *alloc(size_t bytes);
> void *realloc(void *old, size_t want);
> 
> void *zalloc(size_t bytes);
> void *zealloc(void *old, size_t want);
> 
> So alloc is new, we can have that.  Realloc() is OK?  Or not?  Does the
> current one have weird semantics?
> 
> zalloc/zealloc are new, we can have those.
> 
> If you guys like these I can push on Linus and the glibc people.

I'll vote for those, although my dev days are pretty much over.  I've 
never liked malloc() etc not clearing memory, although it has been, ahem, 
useful, in the past...

And I vaguely recall alloc() from Ed5 days (it was an improvement upon 
"sys brk", after all), so it's not new.

-- 
Dave Horsfall DTM (VK2KFU)  "Those who don't understand security will suffer."
 I'll support shark-culling when they have been observed walking on dry land.



More information about the TUHS mailing list