public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libgomp/36298] gomp contains small memoryleak
Date: Fri, 23 May 2008 17:03:00 -0000	[thread overview]
Message-ID: <20080523170309.29349.qmail@sourceware.org> (raw)
In-Reply-To: <bug-36298-12609@http.gcc.gnu.org/bugzilla/>



------- Comment #1 from jakub at gcc dot gnu dot org  2008-05-23 17:03 -------
This is not a memory leak, just misunderstanding what valgrind is reporting.
Memory still reachable at exit time is not a bug, all memory is freed by exit.
Some libraries are instrumented with hooks that at exit time can be called from
memory allocation checker (valgrind, mtrace, ...), e.g. libc, but in some cases
this isn't possible at all and only very few libraries are instrumented that
way.
Memory leak is when something hasn't been freed, but isn't reachable anymore.
The rest are just potential problems that you can analyze.
In libgomp case, most of the allocations still reachable at exit time fall into
the category where they really can't be freed.  Remember the requirement
spelled in threadprivate directive description, if the number of threads is the
same between two consecutive parallel regions and two of the ICVs didn't
change, then
threadprivate vars must be preserved.  This means a thread pool must be live
whenever there was some parallel region, with the number of threads from the
last parallel region.  For that you need some malloced control data structures
and each thread has its TLS allocaed too.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |openmp
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36298


      reply	other threads:[~2008-05-23 17:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-22  7:58 [Bug libgomp/36298] New: " Klaas dot Vantournhout at UGent dot be
2008-05-23 17:03 ` jakub at gcc dot gnu dot org [this message]

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=20080523170309.29349.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).