|
From: Saurabh T <sa...@ho...> - 2020-12-18 14:44:26
|
Hi, I believe I am seeing lots of false positives in valgrind if I call free() on a different thread from the one that called malloc() - the pointers are exchanged between threads safely in between. Is this a known issue, or am I doing something wrong? Thank you. |
|
From: Saurabh T <sa...@ho...> - 2020-12-18 14:58:52
|
Sorry I forgot to say the false positives are for memory leaks ("definitely lost").
From: Saurabh T <sa...@ho...>
Sent: Friday, December 18, 2020 9:44 AM
To: Valgrind <val...@li...>
Subject: [Valgrind-users] Malloc/free in different threads
Hi, I believe I am seeing lots of false positives in valgrind if I call free() on a different thread from the one that called malloc() - the pointers are exchanged between threads safely in between. Is this a known issue, or am I doing something wrong? Thank you.
|
|
From: Philippe W. <phi...@sk...> - 2020-12-18 15:04:42
|
Hello,
No, valgrind/memcheck leak search is not impacted by the fact that one thread allocates
some memory and that the release/free is done by another thread.
That should not lead to a definite leak.
So, if Valgrind tells that there are definite leaks, that is likely real leaks
to be investigated.
Philippe
On Fri, 2020-12-18 at 14:53 +0000, Saurabh T wrote:
> Sorry I forgot to say the false positives are for memory leaks ("definitely lost").
>
>
> From: Saurabh T <sa...@ho...>
> Sent: Friday, December 18, 2020 9:44 AM
> To: Valgrind <val...@li...>
> Subject: [Valgrind-users] Malloc/free in different threads
>
> Hi, I believe I am seeing lots of false positives in valgrind if I call free() on a different thread from the one that called malloc() -
> the pointers are exchanged between threads safely in between. Is this a known issue, or am I doing something wrong? Thank you.
>
> _______________________________________________
> Valgrind-users mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
|
|
From: Saurabh T <sa...@ho...> - 2020-12-18 15:43:49
|
Thank you! Found the bug in my code!
From: Philippe Waroquiers <phi...@sk...>
Sent: Friday, December 18, 2020 10:04 AM
To: Saurabh T <sa...@ho...>; Valgrind <val...@li...>
Subject: Re: [Valgrind-users] Malloc/free in different threads
Hello,
No, valgrind/memcheck leak search is not impacted by the fact that one thread allocates
some memory and that the release/free is done by another thread.
That should not lead to a definite leak.
So, if Valgrind tells that there are definite leaks, that is likely real leaks
to be investigated.
Philippe
On Fri, 2020-12-18 at 14:53 +0000, Saurabh T wrote:
> Sorry I forgot to say the false positives are for memory leaks ("definitely lost").
>
>
> From: Saurabh T <sa...@ho...>
> Sent: Friday, December 18, 2020 9:44 AM
> To: Valgrind <val...@li...>
> Subject: [Valgrind-users] Malloc/free in different threads
>
> Hi, I believe I am seeing lots of false positives in valgrind if I call free() on a different thread from the one that called malloc() -
> the pointers are exchanged between threads safely in between. Is this a known issue, or am I doing something wrong? Thank you.
>
> _______________________________________________
> Valgrind-users mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
|