What is XMALLOC and how it compares with malloc?

ehuang at ix.netcom.com ehuang at ix.netcom.com
Thu May 3 19:42:03 UTC 2007


Dear Mike,

thanks for quickly getting back to me.  

The application is RDESKTOP.  It has mess of both malloc and xmalloc.
Runs fine on Fedora Core (presumely glibc) but get segfaults under Cirrus ARM
linux which uses libcClibc-0.9.28.so    So, I'm trying to understand and
trace the memory management.  Whats frustrating is not finding any decent
explanation thru google about XMALLOC.  Not even wikipedia!


GREP MALLOC

cache.c:                text->data = xmalloc(length);
nwin.c: uint8 *d2 = xmalloc(width * height);
nwin.c: uint8 *d2 = xmalloc(width * height * (depth / 8));
nwin.c: bmp = (GR_IMAGE_HDR*)malloc(sizeof(GR_IMAGE_HDR));
nwin.c: bmp->palette = (MWPALENTRY*)malloc(2 * sizeof(MWPALENTRY));
nwin.c: bmp->imagebits = (MWUCHAR*)malloc(datasize);
nwin.c:STATUS("doing malloc - sizeof %d\n",sizeof(GR_PALETTE) );
nwin.c:    pal = (GR_PALETTE*)malloc(sizeof(GR_PALETTE)); 
nwin.c:    STATUS("malloc error!\n");
nwin.c: pixels = (GR_PIXELVAL*)malloc(cx * cy * depth);
orders.c:       d2 = xmalloc(width*height);
orders.c:       bmpdata = xmalloc(width * height);
orders.c:       map.colours = xmalloc(3 * map.ncolours);
orders.c:               rev_data = xmalloc(datasize);
rdesktop.c:#include <stdlib.h>  /* malloc realloc free */
rdesktop.c:                     char *errormsg = (char *)malloc(500);
rdesktop.c:/* malloc; exit if out of memory */
rdesktop.c:void *xmalloc2(int l, char *s, int size)
rdesktop.c:     void *mem = malloc(size);
rdesktop.c:             ERROR("xmalloc %d\n", size);
rdesktop.c:/* malloc; exit if out of memory */
rdesktop.c:void *xmalloc(int size)
rdesktop.c:     void *mem = malloc(size);
rdesktop.c:             ERROR("xmalloc %d\n", size);
rdp.c:                  rawdata = xmalloc(width * height);
rdp.c:                  rawdata = xmalloc(width * height);
secure.c:       mcs_data.p = mcs_data.data = xmalloc(mcs_data.size);
tcp.c:  in.data = xmalloc(in.size);
tcp.c:  out.data = xmalloc(out.size);







-----Original Message-----
>From: Mike Frysinger <vapier at gentoo.org>
>Sent: May 3, 2007 1:47 AM
>To: uclibc at uclibc.org, ehuang at ix.netcom.com
>Subject: Re: What is XMALLOC and how it compares with malloc?
>
>On Thursday 03 May 2007, ehuang at ix.netcom.com wrote:
>> I can not find anything to explain what is xmalloc with respect to uClibc
>> other than a few cvs checks and diffs.
>
>you're going to have to be a little bit more clear as to what you're referring 
>to when you say "xmalloc" ... there is no such thing in uClibc
>
>xmalloc() is typically an application specific thing that wraps the call to 
>malloc() to make sure it succeeded so that the return checks dont need to be 
>duplicated everywhere else
>-mike




More information about the uClibc mailing list