|
From: Andres T. <and...@ta...> - 2015-04-01 19:37:12
|
Actually they replace malloc(at least in valgrind 3.10.1). For example in the source of drd look at drd_malloc_wrappers.c 2015-04-01 16:25 GMT-03:00 Philippe Waroquiers <phi...@sk...>: > On Tue, 2015-03-31 at 15:28 -0300, Andres Tiraboschi wrote: >> But if you want to replace functions from pthread like helgrind and >> drd do you have to replace the client malloc/free >> I don't know why. > To my knowledge, there is no need to replace malloc/free to have > helgrind or drd working. > > A "proof" of that is that if you use an alternate malloc lib (e.g. > tcmalloc) or a static malloc library, > by default, no replacement will be done. Still these tools do > not crash. > > So, the segv you are seeing is I believe not related to > 'non replacement of malloc/free/...'. > Replacing malloc might just by chance bypass the real underlying > problem. > > Philippe > > >> >> 2015-03-30 15:26 GMT-03:00 Philippe Waroquiers <phi...@sk...>: >> > On Mon, 2015-03-30 at 15:10 -0300, Andres Tiraboschi wrote: >> >> I was making a tool for valgrind for measuring things related with threads. >> >> I made it work but for that, surprisingly I had to replace mallocs and >> >> frees with VG_(needs_malloc_replacement). >> >> If I don't do this I get a segmentation fault. >> >> >> >> In drd if I make that the tool doens't replace the mallocs and frees >> >> there is the same segmentation fault. >> >> >> >> I couldn't find any documentation about this, so I don't know if this >> >> is supposed to be like this or is a bug. >> > No, it is not mandatory to replace (client) malloc/free. >> > >> > There are several tools that do not replace malloc/free. >> > E.g. cachegrind and callgrind are not replacing client malloc/free. >> > >> > Philippe >> > >> > > > |