I'd definitely be in favor of adding this widget to VTK master, but I'll leave that decision to the VTK community and ARB.<br><br>The code is mostly self contained in a pair of qt model/view classes, but also requires modifications to vtkObjectBase.cxx and vtkDebugLeaks{cxx,h} here:<br>
<br> <a href="https://github.com/patmarion/VTK/commit/8b3b7203323859efb493cd76d1d2ca68e22eff62">https://github.com/patmarion/VTK/commit/8b3b7203323859efb493cd76d1d2ca68e22eff62</a><br><br>The main change is that I added hooks to vtkObjectBase.cxx:<br>
<br>diff --git a/Common/vtkObjectBase.cxx b/Common/vtkObjectBase.cxx<br>index 9ea53ec..c75687b 100644<br>--- a/Common/vtkObjectBase.cxx<br>+++ b/Common/vtkObjectBase.cxx<br>@@ -75,10 +75,17 @@ vtkObjectBase::vtkObjectBase()<br>
{<br> this->ReferenceCount = 1;<br> this->WeakPointers = 0;<br>+#ifdef VTK_DEBUG_LEAKS<br>+ vtkDebugLeaks::ObjectConstructed(this);<br>+#endif<br> }<br> <br> vtkObjectBase::~vtkObjectBase() <br> {<br>+#ifdef VTK_DEBUG_LEAKS<br>
+ vtkDebugLeaks::ObjectDestroyed(this);<br>+#endif<br>+<br> // warn user if reference counting is on and the object is being referenced<br> // by another object<br> if ( this->ReferenceCount > 0)<br><br><br>The vtkDebugLeaks::ObjectConstructed/ObjectDestroyed function calls are essentially no-ops unless the widget is activate. And of course when VTK_DEBUG_LEAKS is OFF then the whole thing is skipped. So I think it is pretty unobtrusive the way I have it, but perhaps someone will suggest an alternate implementation.<br>
<br>Note- class counts and reference counts are not updated instantaneously, they are updated when the application event loop cycles. For people interested in pinpointing instantaneous changes, gdb or other debugger is still the best option.<br>
<br>Pat<br><br><br><div class="gmail_quote">On Tue, Feb 15, 2011 at 11:28 AM, Aashish Chaudhary <span dir="ltr"><<a href="mailto:aashish.chaudhary@kitware.com">aashish.chaudhary@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
This is fantastic. Really helpful visual debug tool. <div><br></div><div>Any plans to move it into VTK master? <br><div><br></div><div>Thanks Pat. <br><br><div class="gmail_quote"><div class="im">On Sat, Feb 12, 2011 at 11:04 AM, David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com" target="_blank">david.cole@kitware.com</a>></span> wrote:<br>
</div><div><div></div><div class="h5"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Absolutely brilliant. Nice work, Pat!<div><div></div>
<div><div><br><br><div class="gmail_quote">On Sat, Feb 12, 2011 at 10:57 AM, Utkarsh Ayachit <span dir="ltr"><<a href="mailto:utkarsh.ayachit@kitware.com" target="_blank">utkarsh.ayachit@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">That;s fantastic. Can't wait to try it out next time I am trying to<br>
debug a leak-hell.<br>
<br>
Utkarsh<br>
<div><div></div><div><br>
On Fri, Feb 11, 2011 at 5:49 PM, pat marion <<a href="mailto:pat.marion@kitware.com" target="_blank">pat.marion@kitware.com</a>> wrote:<br>
> Hello vtk and qt heads,<br>
><br>
> I've got a new widget to share with you. Actually it's not new. I wrote<br>
> the code several months ago when I was stuck in an airport. I finally got<br>
> around to rebasing it and pushing to github. I added a wiki page with<br>
> screenshots:<br>
><br>
> <a href="http://vtk.org/Wiki/DebugLeaksView" target="_blank">http://vtk.org/Wiki/DebugLeaksView</a><br>
><br>
> Motivation: VTK_DEBUG_LEAKS is a great help, any developer worth his or her<br>
> salt has it enabled... (right?) But it only reports leaky objects at<br>
> program shutdown. I wanted to spy on my vtk objects at runtime. So I<br>
> created this debug leaks widget. Please see the wiki page for a<br>
> demonstration!<br>
><br>
> Pat<br>
><br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
><br>
><br>
><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br></blockquote></div></div></div><br><br clear="all"><br>-- <br><font color="#888888">| Aashish Chaudhary <br></font><div class="im">| R&D Engineer <br>| Kitware Inc. <br>| <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> <br>
</div></div></div>
</blockquote></div><br>