public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/107857] New: recursive_mutex misses destructor if non-function call initialization is used
@ 2022-11-24  9:41 pg.ensiie at gmail dot com
  2023-12-15 12:17 ` [Bug libstdc++/107857] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: pg.ensiie at gmail dot com @ 2022-11-24  9:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107857

            Bug ID: 107857
           Summary: recursive_mutex misses destructor if non-function call
                    initialization is used
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pg.ensiie at gmail dot com
  Target Milestone: ---

Hello,

Using GCC 11.2.0 with mingw-w64 9.0.0.

I notice that there is a memory leak when using a std::recursive_mutex, as
described in this issue : https://sourceforge.net/p/mingw-w64/bugs/851/. I
reproduce this bug.

After some research, I discover that same problem has occured for std::mutex,
that was solved by this fix : https://sourceforge.net/p/mingw-w64/bugs/851/

The solution is to use function initialized and destructor for recursive_mutex
as it is done for mutex when using pthread on windows. Defining
_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC in os_defines.h fixes the bug.

Even if I do not use it, I wonder if _GTHREAD_USE_COND_INIT_FUNC should also be
set for condition variables.

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

end of thread, other threads:[~2023-12-15 12:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-24  9:41 [Bug libstdc++/107857] New: recursive_mutex misses destructor if non-function call initialization is used pg.ensiie at gmail dot com
2023-12-15 12:17 ` [Bug libstdc++/107857] " redi at gcc dot gnu.org
2023-12-15 12:31 ` redi at gcc dot gnu.org
2023-12-15 12:32 ` redi 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).