On 02/07/14 22:42 +0100, Goncalo Carvalho wrote:
Hi,
In parallel/unique_copy.h __counter is never deleted.
I'm also trying to follow from other posts how to submit a patch but
is well possible I missed some of the conventions. Many apologies if
that's the case.
Thanks for this, it looks correct.
(I thought I remembered finding something similar in another parallel
header, but don't see anything in the ChangeLog.)
Do you have a testcase to reproduce the leak that we could add to the
testsuite? Or even just to run once with valgrind and verify it's
fixed (I tried a trivial test and didn't see a leak).
libstdc++-v3/
* include/parallel/unique_copy.h: prevent memory leak of __counter
Index: libstdc++-v3/include/parallel/unique_copy.h
===================================================================
--- libstdc++-v3/include/parallel/unique_copy.h (revision 212239)
+++ libstdc++-v3/include/parallel/unique_copy.h (working copy)
@@ -171,6 +171,7 @@
for (_ThreadIndex __t = 0; __t < __num_threads + 1; __t++)
__end_output += __counter[__t];
+ delete[] __counter;
delete[] __borders;
return __result + __end_output;