[PATCH] Introduce xmalloc, memory allocator with die_out_of_memory()

Dmitry V. Levin ldv at altlinux.org
Fri Mar 20 21:52:32 UTC 2015


On Fri, Mar 20, 2015 at 02:30:59PM -0400, Mike Frysinger wrote:
> On 20 Mar 2015 13:30, Dmitry V. Levin wrote:
> > On Fri, Mar 20, 2015 at 02:53:39PM +0900, Masatake YAMATO wrote:
> > > In strace following code sentences are frequently used:
> > > 
> > >    var = malloc(fdsize);
> > >     if (!var)
> > >        die_out_of_memory();
> > > 
> > > This patch introduces xmalloc and friends which simplify
> > > above sentences like:
> > > 
> > >    var = xmalloc(fdsize);
> > > 
> > > Here friends are xcalloc and xrealloc.
> > 
> > Do we need xrealloc in its classic form, or rather an edition
> > with an integer overflow check?
> 
> 
> a xcalloc variant that doesn't clear memory would be nice (and checks the 
> multiplication),

xnmalloc?

> is there a standard naming for the array allocator ?

xnmalloc, xnrealloc?


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150321/c4b3318b/attachment.bin>


More information about the Strace-devel mailing list