public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: "Paul Pluzhnikov via libc-help" <libc-help@sourceware.org>
To: mebeyn@gmail.com
Cc: libc-help@sourceware.org
Subject: Re: fopen from within a pthread
Date: Sat, 02 Jun 2018 22:49:00 -0000	[thread overview]
Message-ID: <CALoOobPHVFYCGpoTmftYMYHvRe=7QTrz_MBY-QwJ04tTMDX4uQ@mail.gmail.com> (raw)
In-Reply-To: <CADpW=+3ve0oLtby3gneBdiQekjUnqZ66yvhkPUV-LSD9F=dg-g@mail.gmail.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

  reply	other threads:[~2018-06-02 22:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-02 22:30 Martin Beynon
2018-06-02 22:49 ` Paul Pluzhnikov via libc-help [this message]
2018-06-04 14:38   ` Carlos O'Donell
2018-06-04 16:13     ` Martin Beynon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALoOobPHVFYCGpoTmftYMYHvRe=7QTrz_MBY-QwJ04tTMDX4uQ@mail.gmail.com' \
    --to=libc-help@sourceware.org \
    --cc=mebeyn@gmail.com \
    --cc=ppluzhnikov@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).