bug-coreutils
[Top][All Lists]
Advanced

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

Re: Problems on darwin with coreutils-6.10.133-677610


From: Pádraig Brady
Subject: Re: Problems on darwin with coreutils-6.10.133-677610
Date: Wed, 26 Mar 2008 09:45:44 +0000
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Jim Meyering wrote:
> Eric Blake <address@hidden> wrote:
>> According to Jim Meyering on 3/25/2008 3:47 PM:
>> | -      user_name = pwd ? pwd->pw_name : NULL;
>> | +      user_name = pwd ? xstrdup (pwd->pw_name) : NULL;
>>
>> Doesn't this leak memory?
> 
> Thanks for mentioning it, but I think of this as a pseudo leak,
> since that allocated storage is still reachable at exit:
> 
>     $ valgrind --leak-check=full --show-reachable=yes ./id -G
>     ...
>     ==18858== 9 bytes in 1 blocks are still reachable in loss record 1 of 4
>     ==18858==    at 0x4C20FAB: malloc (vg_replace_malloc.c:207)
>     ==18858==    by 0x403D49: xstrdup (in /f/w/cu/src/id)
>     ==18858==    by 0x40198E: main (id.c:214)
>     ...
> 
> IMHO, it's best not even to try to free such memory,
> unless the total amount can become large enough to interfere
> with regular operation.

It's easier to use the tools though without this "noise".
For my own programs I often change main to run in an
infinite loop (with suitable ulimit) to check leaks.

Pádraig.




reply via email to

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