Created attachment 59418 [details] code to reproduce problem Environment ----------- ubuntu 24.04 libstdc++ 13.2 from ubuntu repos but also 14.2 and judging by libstdc++ github mirror the latest head also has this problem sudo apt install libtbb-dev ## this is obviously required Problem ------- when calling `std::sort(std::execution::par_unseq` repeatedly it leaks memory, and will ultimately deplete the machine and get killed by the kernel. the attached
Created attachment 59419 [details] patch which solves the problem this patch applies cleanly to libstdc++ 13.2 and 14.2 and also to head I believe. It solves the problem. The code change is from here: https://github.com/oneapi-src/oneDPL/pull/1589/files By one of the people on the TBB / oneDPL team. it cannot be applied to TBB ( I did ask there) because the bug is in the "glue/interface" code between libstdc++ and TBB and managed by libstdc++
Sorry, premature submit on original report comment. continuing... The attached sort_leak.cpp (59418) shows the problem. Single threaded sort is fine, par_unseq is not. output: Single threaded sort: VM: 14544 RSS: 11648 (kB) VM: 14616 RSS: 11588 (kB) VM: 14616 RSS: 11588 (kB) VM: 14616 RSS: 11588 (kB) VM: 14616 RSS: 11588 (kB) par_unseq sort: VM: 29372 RSS: 17860 (kB) VM: 33468 RSS: 19652 (kB) VM: 33468 RSS: 21316 (kB) VM: 37564 RSS: 23108 (kB) VM: 37564 RSS: 24772 (kB) Related bug reports: Issue filed by me on oneTBB: https://github.com/oneapi-src/oneTBB/issues/1533 my repo with demo code, instructions and references should they be needed: https://github.com/oneapi-src/oneTBB/issues/1533 Pull request on oneDPL which fixes it https://github.com/oneapi-src/oneDPL/pull/1589/files (that is what my patch is based on) Solution -------- As stated above, the attached patch (59419) fixes the issue