|
From: Sree O. <so...@vm...> - 2005-07-28 23:02:09
|
Hello Is there a way to get incremental leaks using valgrind ? If yes, how do I do it ? If no, when will this feature be available? I am currently using 2.4.0. (I think Purify has this option). I browsed the user-group archives but found no relevant answer to this. Thanks in advance. Sree |
|
From: Bob R. <bo...@br...> - 2005-07-28 23:12:20
|
On Thu, Jul 28, 2005 at 04:01:24PM -0700, Sree Oggu wrote: > Hello > > Is there a way to get incremental leaks using valgrind ? > > If yes, how do I do it ? Could you describe a little more what you mean by 'incremental leaks'? You can have valgrind detect memory leaks in your program at any point during it's execution by calling the VALGRIND_COUNT_LEAKS macro in valgrind.h. Bob Rossi |
|
From: Tom H. <to...@co...> - 2005-07-28 23:15:40
|
In message <58743620D2C0D9439C627C064581E252010C6AC0@PA-ECLUSTER2.vmware.com> "Sree Oggu" <so...@vm...> wrote: > Is there a way to get incremental leaks using valgrind ? I'm not entirely sure I understand what you're asking for? Can you explain what you mean? > If yes, how do I do it ? Well you can use the VALGRIND_DO_LEAK_CHECK client request to get valgrind to check for leaks but it sounds like you want something more automatic than that? Leak checking is fairly expensive, so you wouldn't want to do it too often - are you suggest that valgrind should have some sort of timer and check for leaks every few minutes or something? Tom -- Tom Hughes (to...@co...) http://www.compton.nu/ |
|
From: Avery P. <ape...@ni...> - 2005-07-28 23:23:56
|
On Fri, Jul 29, 2005 at 12:15:22AM +0100, Tom Hughes wrote: >"Sree Oggu" <so...@vm...> wrote: > > Is there a way to get incremental leaks using valgrind ? > > Well you can use the VALGRIND_DO_LEAK_CHECK client request to get > valgrind to check for leaks but it sounds like you want something > more automatic than that? > > Leak checking is fairly expensive, so you wouldn't want to do it > too often - are you suggest that valgrind should have some sort of > timer and check for leaks every few minutes or something? I don't know what the original poster was asking for, but here's something I wish I could do: - have my app run VALGRIND_DO_LEAK_CHECK at certain checkpoints - each time (except the first), print out the list of allocated memory blocks that are *new* (even if still reachable) from the last checkpoint to the current one. This is really handy for finding memory "not quite leaks" like certain parts of a program that suddenly allocate a lot of RAM and don't free it up for a while. I like massif, but it's a bit overkill for the sort of problem I run into sometimes: one little bit of code that accumulates a lot of data and doesn't let it go until it exits. In the past, I've debugged such problems by doing VALGRIND_DO_LEAK_CHECK and writing some cheesy perl scripts to compare the results. It's not perfect, but it works :) Have fun, Avery |