On 4/13/17 4:12 PM, Reuben Thomas wrote:
> Here they are. I guess you probably won't care about them as as far as I
> can see they are all one-off allocations at initialization:
> 
> ==1289== 276 bytes in 1 blocks are definitely lost in loss record 230 of 249
> ==1289==    at 0x4C2DB2F: malloc (in
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==1289==    by 0x4793CF: xmalloc (xmalloc.c:112)
> ==1289==    by 0x472F48: set_default_locale (locale.c:81)
> ==1289==    by 0x420900: main (shell.c:411)

This one is interesting. It's come up before. Bash makes a copy of the
default locale (as returned by setlocale()) for its own purposes.  Some
systems use a static buffer for that value; some systems, including glibc,
return allocated memory (even though the man page warns to not assume
anything about the returned string).

You're right about the two buffers for setlinebuf().

Thanks.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to