On Fri, 2019-02-08 at 21:02 +0330, Ahmad Nouralizadeh wrote:
> Thanks David,
> But heaptrack even reports a larger number: 153 MB!
> 
> On Fri, Feb 8, 2019 at 8:09 PM David Faure <fa...@kde.org> wrote:
> > On vendredi 8 février 2019 16:32:50 CET Ahmad Nouralizadeh wrote:
> > > Hi,
> > > I wrote a really simple Pin tool to calculate the number of dynamically
> > > allocated bytes in a program. I instrumented GIMP with this tool and it
> > > reported 77 MB of allocations. I did the same experiment with Valgrind
> > > which reported 117 MB.
> > > My Pin tool is similar to the example in Pin. It searches for malloc(),
> > > calloc() and memalign() in each loaded image and adds instructions before
> > > them to calculate the total size of the allocations.
> > > I am really confused and need help!

What I suggest is to try with much smaller executables and investigate
when you see a difference.

For example, do the following in a valgrind build:
   valgrind --xtree-memory=full ./memcheck/tests/trivialleak
This will output the total allocations observed by valgrind.
It will also produce a file xtmemory.kcg.<PID>
that gives the detailed information about the malloc/free calls
(to visualise with kcachegrind).

Compare this with what is given by the 2 other measurements.
Try with somewhat more complex programs if you see no difference,
till you find a difference with (let's hope) something simple
enough that you can understand where the difference is coming from.

With valgrind, you can also trace all the malloc/free calls
using --trace-malloc=yes.

Philippe




_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to