public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/51636] New: Thread-safeness of new and delete operators
@ 2011-12-20 12:31 ingo at pyrillion dot org
  2011-12-20 12:35 ` [Bug libstdc++/51636] " ingo at pyrillion dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ingo at pyrillion dot org @ 2011-12-20 12:31 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51636
           Summary: Thread-safeness of new and delete operators
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ingo@pyrillion.org


Dear colleagues,

I had a nasty thread-safeness bug that I finally did not track down completely
(but solved).

My system: Linux ubuntu 3.0.0-14-generic #23-Ubuntu SMP Mon Nov 21 20:28:43 UTC
2011 x86_64 x86_64 x86_64 GNU/Linux
My gcc: gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
libstdc++: libstdc++.so.6.0.16

Problem: application crashes if too many concurrent POSIX threads get started

Description: application is platform-independent; was developed for Win32/Win64
and Linux 32bit/64bit

If executed with valgrind/hellgrind (Linux) or Microsoft Application Verifier
(Windows 7/64bit), then no errors occur.

If executed on above mentioned host AND more than 100 concurrent threads
performing a lot of new/delete operations, then memory clobbered. Application
was tested using valgrind or GNU mprobe, respectively. GNU mprobe aborts
application with memory clobbered before memory block. All sources compiled
with "-pthread", "-fpic". Error occurs with Debug and Release build. POSIX
threads are performing a mix of new/delete/malloc/free and use thread-specific
data.

My fix: Wrote another shared object implementing malloc/calloc/free/realloc,
new/delete/new[]/delete[] with and without throw(std::bad_alloc). Linking this
shared object to my application fixes the problem.

Guess: the new/new[] operators throwing std::bad_alloc have a MT-safeness
problem.

Sorry for this obfuscating bug report but I am not allowed to disclose more
information. Maybe someone ran into this bug?, too?


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-10-16 13:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-20 12:31 [Bug libstdc++/51636] New: Thread-safeness of new and delete operators ingo at pyrillion dot org
2011-12-20 12:35 ` [Bug libstdc++/51636] " ingo at pyrillion dot org
2011-12-20 21:04 ` paolo.carlini at oracle dot com
2012-01-24 19:48 ` pinskia at gcc dot gnu.org
2013-10-16 13:16 ` glisse at gcc dot gnu.org

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).