Re: [Valgrind-users] massif & counts per type

2020-09-12 Thread Philippe Waroquiers
On Fri, 2020-09-11 at 12:38 +0200, Milian Wolff wrote:
> And finally, with heaptrack it is also not yet easily doable to get a diff 
> between two time stamps. Also a feature I've long thought about implementing, 
> but never got around to...
Note that valgrind allows to report a "delta/diff" memory heap status e.g.
under memcheck. See memcheck leak_check monitor command.

Philippe




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


Re: [Valgrind-users] massif & counts per type

2020-09-12 Thread Philippe Waroquiers
On Thu, 2020-09-10 at 15:26 +0200, folkert wrote:
> Hi,
> 
> How can I obtain the number of mallocs per type in a time-frame using
> massif? I'm NOT interested in the total in use, I would like to know how
> often type x is allocated between t+1 and t+2.
You could run your application under valgrind + gdb/vgdb.
You can then put breakpoints at relevant places to trigger them at
t+1 and t+2.

You can then e.g. run with memcheck and have delta malloc info
being reported, using the memcheck monitor command leak_check.
This command can show the delta "alloc/free" since the previous
call.

Philippe




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


Re: [Valgrind-users] valgrind always fails with out of memory

2020-09-12 Thread Philippe Waroquiers
On Tue, 2020-09-08 at 14:09 +0200, Mario Emmenlauer wrote:
> On 08.09.20 12:25, Mario Emmenlauer wrote:
> > On 08.09.20 12:04, Mario Emmenlauer wrote:
> > > The error I get most frequently is (full output attached in log.txt)
> > > ==32== Valgrind's memory management: out of memory:
> > > ==32==newSuperblock's request for 6864695621860790272 bytes 
> > > failed.
> > > ==32==  114,106,368 bytes have already been mmap-ed ANONYMOUS.
> > 
> > Argh! After sending the email, I went through the stack trace for
> > the hundredth time, and spotted the use of "zlib". And indeed, when
> > replacing my own zlib 1.2.11 with the system zlib 1.2.11, valgrind
> > works as expected!
> > 
> > Does that make sense? Is zlib used by valgrind itself? And why could
> > my debug build differ (so much) from the system zlib that it breaks
> > valgrind? I double-checked and its the identical source code from
> > Ubuntu, just missing two or three patches.
> 
> So it seems I can (partially) answer my own question: when valgrind
> is used on an executable that links zlib built with -ggdb3, then it
> does not work (due to aforementioned error). Keeping all other debug-
> settings except -ggdb3 works still fine.
> 
> I have no clue as to _why_ this may happen, but I hope it can be
> helpful to other people running into the same issue.
zlib is not used by the valgrind tools. In fact, valgrind tools
do not use any library (even not libc).

The above newSuperblock trace shows that a *huge* block is requested.
As this bug only happens when you use -ggdb3, this is likely a problem
in the debuginfo reader of valgrind: some debug info generated by 
-ggdb3 is very probably not handled properly.

I have recompiled libz with -ggdb3, but no problem when running this
lib under valgrind.

We might have a more clear idea of what happens on your side 
by adding some trace.

The best is to file a bug on bugzilla, and attach the output of
running valgrind with -d -d -d -v -v -v.

That might give some information about what is wrong
and possibly some more detailed trace can then be activated.

Thanks
Philippe




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


Re: [Valgrind-users] massif & counts per type

2020-09-12 Thread folkert
> Anyhow, it sounds like you are starting to reinvent heaptrack - it does 
> exactly the above and then some.

Indeed it does: I looked at and it is perfectly for my use-case.
Thank you!



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