Re: aiops.c and xmalloc

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Wed, 04 Oct 2000 20:41:44 +0200

Andres Kroonmaa wrote:
>
> aiops.c has several xmallocs in form of:
>
> if ((requestp->path = (char *) xmalloc(len)) == NULL) {
> memPoolFree(aio_request_pool, requestp);
> errno = ENOMEM;
> return -1;
> }
>
> AFAIK xmalloc cannot ever return with NULL, so this check
> seems useless.

True, but Stewart was not sure about this when he wrote it once in a
time.. might be that xmalloc was not even used then.

> Is it there for some reason or is just remains since times
> when xmalloc was not used?

Purely old remains. Not needed today, but since it is there why removing
it..

> Is there any reason why aiops needs to copy path strings
> into private membuffer instead of just miving pointer?

Yes. The path memory area is reused on the next object open attempt,
which might come way before the first one has even started..

> I'm looking into possible memleaks in aiops and I wanted to
> convert it into using memPools.

I prefer attacking it from a architectural point, to build an
architecture where asyncronous operations are supported without
requiring the duplicating hacks done by aiops to isolate the callers
from the asyncronous nature...

Of the 4 xmalloc calls there is in aiops, only one is easily
transferrable to memory pools.. (the struct stat one).

/Henrik
Received on Wed Oct 04 2000 - 13:23:40 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:40 MST