[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is malloc garbage collecting?
From: |
Marcus Brinkmann |
Subject: |
Re: Is malloc garbage collecting? |
Date: |
Sun, 14 Apr 2002 13:04:52 -0400 |
User-agent: |
Mutt/1.3.25i |
On Sun, Apr 14, 2002 at 05:20:55PM +0200, Wolfgang J?hrling wrote:
> Wolfgang J?hrling <wolfgang@pro-linux.de> wrote:
> > Looking at what glibc/hurd/fd-read.c does, it seems to be a leak to not
> > check for equality and freeing the buffer. Does anyone agree/disagree?
>
> Well, I think I have to disagree with me here. :*)
>
> Looking at hurd/hurd/io.defs, this parameter is specified as
>
> out data: data_t, dealloc;
>
> Maybe I'm just understanding the MiG documentation wrong, but I thought
> the "dealloc" would take care of exactly this case. (Which was probably
> the reason I originaly wrote the code the way I did).
This does only have an effect on the server side and is necessary
because the server doesn't have a chance to release a return buffer it
allocated after it passed control back to mig (otherwise mig would need
to call a cleanup handler for data buffers).
> But then I don't understand why the glibc code copies the data back from
> the newly allocated space to the old one (provided by the client).
Because glibc implements the POSIX read() function, which reads into the
user supplied buffer.
Thanks,
Marcus