[Bug libstdc++/71684] Memory leak with std::mutex and std::lock_guard on freebsd

2025-03-05 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71684 --- Comment #12 from Jonathan Wakely --- As suggested in comment 5, we might want to make the use of __gthread_mutex_destroy platform-specific, i.e. have a new config macro that says we need the destroy even when we use INIT. That way the change

[Bug libstdc++/71684] Memory leak with std::mutex and std::lock_guard on freebsd

2025-03-05 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71684 --- Comment #11 from Jonathan Wakely --- Yes but for std::mutex we currently have no user-provided destructor if the INIT macro is supported. If we add a ~__mutex_base() that unconditionally uses __gthread_mutex_destroy that might be an ABI chang

[Bug libstdc++/71684] Memory leak with std::mutex and std::lock_guard on freebsd

2025-03-05 Thread christian.prochaska--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71684 --- Comment #10 from Christian Prochaska --- std::__condvar always calls __gthread_cond_destroy() even if __GTHREAD_COND_INIT is used. So, it's handled differently there than in std::__mutex_base.

[Bug libstdc++/71684] Memory leak with std::mutex and std::lock_guard on freebsd

2025-03-05 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71684 --- Comment #9 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #8) > Yes, that firces *forces

[Bug libstdc++/71684] Memory leak with std::mutex and std::lock_guard on freebsd

2025-03-05 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71684 --- Comment #8 from Jonathan Wakely --- Yes, that firces the use of pthread_mutex_create and pthread_mutex_destroy, which gives the OS a chance to free memory on destroy. I don't recall what happened with FreeBSD, I think they moved away from al

[Bug libstdc++/71684] Memory leak with std::mutex and std::lock_guard on freebsd

2025-03-05 Thread christian.prochaska--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71684 --- Comment #7 from Christian Prochaska --- Bug 57440 solved the problem for mingw32 by defining _GTHREAD_USE_MUTEX_INIT_FUNC in os_defines.h.

[Bug libstdc++/71684] Memory leak with std::mutex and std::lock_guard on freebsd

2025-03-04 Thread christian.prochaska--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71684 Christian Prochaska changed: What|Removed |Added CC||christian.prochaska@genode-

[Bug libstdc++/71684] Memory leak with std::mutex and std::lock_guard on freebsd

2016-06-28 Thread nsz at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71684 --- Comment #5 from nsz at gcc dot gnu.org --- (In reply to Jonathan Wakely from comment #3) > (In reply to nsz from comment #1) > > on a posix platform pthread_mutex_destroy should be called for a mutex if > > its life time ends, so the ifdef log

[Bug libstdc++/71684] Memory leak with std::mutex and std::lock_guard on freebsd

2016-06-28 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71684 --- Comment #4 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #3) > On some older versions of FreeBSD using PTHREAD_MUTEX_INITIALIZER and then > pthread_mutex_destroy would segfault, see > http://lists.freebsd.org/pipermail/fr

[Bug libstdc++/71684] Memory leak with std::mutex and std::lock_guard on freebsd

2016-06-28 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71684 --- Comment #3 from Jonathan Wakely --- (In reply to nsz from comment #1) > on a posix platform pthread_mutex_destroy should be called for a mutex if > its life time ends, so the ifdef logic seems wrong (the initializer does not > make a differen

[Bug libstdc++/71684] Memory leak with std::mutex and std::lock_guard on freebsd

2016-06-28 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71684 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed|

[Bug libstdc++/71684] Memory leak with std::mutex and std::lock_guard on freebsd

2016-06-28 Thread nsz at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71684 nsz at gcc dot gnu.org changed: What|Removed |Added CC||nsz at gcc dot gnu.org --- Comme