This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/64535] Emergency buffer for exception allocation too small
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 27 Jan 2015 12:22:14 +0000
- Subject: [Bug libstdc++/64535] Emergency buffer for exception allocation too small
- Auto-submitted: auto-generated
- References: <bug-64535-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64535
--- Comment #21 from Richard Biener <rguenth at gcc dot gnu.org> ---
We can make it extra-safe but still deallocate in most common cases:
pool::~pool ()
{
__gnu_cxx::__scoped_lock sentry(emergency_mutex);
if (arena
&& arena == reinterpret_cast <char *> (first_free_entry)
&& arena_size == first_free_entry->size)
{
free (arena);
arena = NULL;
first_free_entry = NULL;
}
}
this ensures threads won't continue allocating from the pool. Well,
they may in case some other thread frees some exception... So indeed
running a destructor makes the whole stuff undefined (object lifetime
of the pool ended) :/