From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 35394 invoked by alias); 2 Jun 2018 22:49:00 -0000 Mailing-List: contact libc-help-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: libc-help-owner@sourceware.org Received: (qmail 35216 invoked by uid 89); 2 Jun 2018 22:48:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-9.9 required=5.0 tests=BAYES_00,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_PASS,USER_IN_DEF_SPF_WL autolearn=ham version=3.3.2 spammy=HX-HELO:sk:mail-yw, HX-Received:a81, H*RU:sk:mail-yw, Hx-spam-relays-external:sk:mail-yw X-HELO: mail-yw0-f170.google.com Received: from mail-yw0-f170.google.com (HELO mail-yw0-f170.google.com) (209.85.161.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 02 Jun 2018 22:48:44 +0000 Received: by mail-yw0-f170.google.com with SMTP id v131-v6so6623883ywg.2 for ; Sat, 02 Jun 2018 15:48:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+M7m/unsaOvaSLPYfBuVdRFuCkwo66SaeKFWDoheOpo=; b=nJByX2tdktpei0dPqWkQNPMHBYBoGCADL9MzjGb4igtXYON5BZpvcYZ+QzfKmRvhmZ OjbBui+QJs9B/GdtsQ8pnQRHWLk0ZOvz0r+RhbrvBUb7zS/RDSJE04TwiPggx6Y0O1Y9 NohZHqBHBAWTnEU4jhbMMShVhOGWVoiTu78Nqy4fFTuv/M+SM7rrJYhfLM0C1S+B6VEX RBBL+LM+d+hpwmSKBgjORXxfr54m3OWX+CcvzhDEkGmSM0o2l5Ran0/Sp21/BDNeSgHk X7W+qCUG9ZNmR9rEFAfyEu/REJY/jZkFkU2H/7o6wKNnUQc9Co1No9QP9t6TdEbEP3IE 2XDw== X-Gm-Message-State: ALKqPwebFe5DuaZ5zou5K6l5oquEZMYn6hS9XrOPWhNkT6MWEpzpXNWD xYqC7BKupJ94wW/lQ9EfSv0ppx+zlz/oFP0aQxVleg== X-Google-Smtp-Source: ADUXVKKLp4+5o3GrUuu4CzOBOw5aZ/e4QRvfNE6YW/xfKXTGcc7dzuseA9oEVafQs8UjLJEFqpz+D4VxiugTtWm/kls= X-Received: by 2002:a81:6206:: with SMTP id w6-v6mr8406609ywb.275.1527979722621; Sat, 02 Jun 2018 15:48:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Paul Pluzhnikov via libc-help" Reply-To: Paul Pluzhnikov Date: Sat, 02 Jun 2018 22:49:00 -0000 Message-ID: Subject: Re: fopen from within a pthread To: mebeyn@gmail.com Cc: libc-help@sourceware.org Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00007.txt.bz2 On Sat, Jun 2, 2018 at 3:31 PM Martin Beynon 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