public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Godmar Back <godmar@gmail.com>
Cc: Ian Pilcher via Libc-help <libc-help@sourceware.org>,
	 Ian Pilcher <arequipeno@gmail.com>
Subject: Re: Bug or not? printf allocates buffer & never frees it
Date: Wed, 17 Mar 2021 22:03:57 +0100	[thread overview]
Message-ID: <87a6r1wkzm.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAB4+JY+JKtkHwernq6OPf7arRzA_XGDfG37hzvzS8=P-0N8fzQ@mail.gmail.com> (Godmar Back's message of "Wed, 17 Mar 2021 16:47:31 -0400")

* Godmar Back:

> Is GNU libc designed to be used in environments that do not deallocate
> all memory upon exit(), i.e., environments that can call exit()
> multiple times without being provided with a fresh heap each time?  I
> understand ISO C allows this and POSIX is quiet on this specific
> issue. Is complete deallocation of one-time buffers before exit() a
> design goal of GNU libc?

Not really.  None of the currently supported targets behave in that way.
We have __libc_freeres to clean up *after* exit (and atexit handlers
etc.), but it only exists for leak debuggers.  valgrind can call it, for
example, and we also call it in mtrace mode.  It's also a bit of a
reasonable effort thing: there are allocations we currently do not free,
particularly around dlopen.

Thanks,
Florian


  reply	other threads:[~2021-03-17 21:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17 17:30 Ian Pilcher
2021-03-17 17:45 ` Florian Weimer
2021-03-17 20:29   ` Ian Pilcher
2021-03-17 20:47   ` Godmar Back
2021-03-17 21:03     ` Florian Weimer [this message]
2021-03-17 19:23 ` Konstantin Kharlamov

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=87a6r1wkzm.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=arequipeno@gmail.com \
    --cc=godmar@gmail.com \
    --cc=libc-help@sourceware.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).