This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: fopen from within a pthread
- From: "Paul Pluzhnikov via libc-help" <libc-help at sourceware dot org>
- To: mebeyn at gmail dot com
- Cc: libc-help at sourceware dot org
- Date: Sat, 2 Jun 2018 15:48:11 -0700
- Subject: Re: fopen from within a pthread
- References: <CADpW=+3ve0oLtby3gneBdiQekjUnqZ66yvhkPUV-LSD9F=dg-g@mail.gmail.com>
- Reply-to: Paul Pluzhnikov <ppluzhnikov at google dot com>
On Sat, Jun 2, 2018 at 3:31 PM Martin Beynon <mebeyn@gmail.com> wrote:
>
> Is this erroneous behaviour, or can this be explained in some way?
There is nothing erroneous about it.
What you are observing is the creation of thread-specific arena, from
which malloc will return memory to the new thread.
GLIBC uses thread-specific arenas to avoid having to lock malloc
internal structures when multiple threads allocate and free memory.
Additional info can be found here:
https://sourceware.org/glibc/wiki/MallocInternals
--
Paul Pluzhnikov