help-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is malloc garbage collecting?


From: Guy Bormann
Subject: Is malloc garbage collecting?
Date: Sun, 14 Apr 2002 14:16:02 +0200

Hi,

Just out of curiosity I was browsing Wolfgang's "Hurd Hacking
Guide" webpage. In the dump.c example a buffer char* buf is
allocated using malloc() and &buf is passed to the io_*
routine(s). Then, in the /dev/one Hurd-counterpart example is
explained why that should be (i.e. the mmap'ing when the
user-provided return buffer is too small to handle the request).
  However, what happens to the originally allocated pointer in the
user program? Is that properly handled by mmap or is this a leak?
(It is OK in small example programs but not for long-running
programs that repeatedly allocate buffers.) Or is there a mistake
in dump.c and should the user program free(buf) when it has
changed?


Guy Bormann



reply via email to

[Prev in Thread] Current Thread [Next in Thread]