<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Thanks to all for the quick responses. These are great suggestions
and are helping a lot to narrow-down the problem.<br>
Regards,<br>
Jim<br>
<br>
-------------------------------------------------------<br>
<br>
<div dir="ltr">On quick suggestion configure vtk to have
VTK_DEBUG_LEAKS on (on the advanced set of cmake options) and
rebuild.
<div><br>
</div>
<div>Then when you exit the program it will tell you what VTK
instances have not been entirely dereferences and thus not yet
deallocated.
<div><br>
</div>
<div>That should help narrow it down.</div>
<div><br>
</div>
</div>
</div>
<br clear="all">
<div>
<div class="gmail_signature">David E DeMarle<br>
Kitware, Inc.<br>
R&D Engineer<br>
21 Corporate Drive<br>
Clifton Park, NY 12065-8662<br>
Phone: 518-881-4909</div>
</div>
<br>
---------------------------------------------------------<br>
<pre wrap="">Jim,
here is the strategy I've used:
1) make sure you build debug with "VTK_DEBUG_LEAKS" enabled.
2) use google-test or some other framework that will report a test failure if program exits with non-zero code.
3) write tests in increasing complexity until you cause a leak in a unit test; then track it down in whatever class(es) are at fault.
For example, below are a simple and medium complexity test; they are exercising a couple of classes that derive from VTK's base classes. Initially, the first test reported a leak; I fixed that vtkSphereWidgetWrapper class. Then, the medium complexity one still failed; this required touching a few files to fix.
// simplest
TEST(CrashTest,ValgrindMe_vtkSphereWidgetWrapperNoRenderWindow)
{
for( int outer = 0; outer < 1; outer++ ) {
vtkUniquePtr<vtkSphereRepresentationWrapper> tmp;
EXPECT_TRUE(tmp.get()!=nullptr);
}
}
// medium complexity
TEST(MemTest,ValgrindMe_vtkSphereWidgetWrapper)
{
vtkUniquePtr<vtkRenderer> ren;
vtkUniquePtr<vtkRenderWindow> win;
ren->SetRenderWindow(win.get());
{
vtkUniquePtr<vtkSphereWidgetWrapper> tmp;
tmp->SetCurrentRenderer(ren.get());
tmp->Modified();
tmp->GetRepresentation()->Modified();
win->Render();
}
}
_______________________
regards,
peter karasev</pre>
<br>
------------------------------------------------------------------------------<br>
<br>
<div class="moz-cite-prefix">On 2/11/2015 10:31 AM, David E DeMarle
wrote:<br>
</div>
<blockquote
cite="mid:CANjZAi8C=zOkoSEor93_WMyKbHN8S=FrkMtQg+O5=u8zNwgp9w@mail.gmail.com"
type="cite">
<div dir="ltr">On quick suggestion configure vtk to have
VTK_DEBUG_LEAKS on (on the advanced set of cmake options) and
rebuild.
<div><br>
</div>
<div>Then when you exit the program it will tell you what VTK
instances have not been entirely dereferences and thus not yet
deallocated.
<div><br>
</div>
<div>That should help narrow it down.</div>
<div><br>
</div>
</div>
</div>
<div class="gmail_extra"><br clear="all">
<div>
<div class="gmail_signature">David E DeMarle<br>
Kitware, Inc.<br>
R&D Engineer<br>
21 Corporate Drive<br>
Clifton Park, NY 12065-8662<br>
Phone: 518-881-4909</div>
</div>
<br>
</div>
</blockquote>
--------------------------------------------------------<br>
<br>
<blockquote
cite="mid:CANjZAi8C=zOkoSEor93_WMyKbHN8S=FrkMtQg+O5=u8zNwgp9w@mail.gmail.com"
type="cite">
<div class="gmail_extra">
<div class="gmail_quote">On Wed, Feb 11, 2015 at 10:02 AM, James
Labiak <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:jim@jslengineeringsoftware.com"
target="_blank">jim@jslengineeringsoftware.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">I have a
Java GUI application which runs without memory leaks. It
loads a database of simulations and displays 2D graphs for
output. I added VTK code so that I can also display 3D
graphs. Now, when I repeatedly display/cycle through the the
same 4 VTK graphs (or different graphs) many times, the
program uses increasing memory until the computer runs out
of RAM and the application fails to respond. It seems to
have a memory leak related to VTK. Memory is only freed when
I then kill the application process. I have searched for
information on this and tried to address various potential
issues without success. In version 6.0, the VTK garbage
collection method seems to have been removed. I think that I
addressed potential reference count issues by providing VTK
object references that go through the Java object layer. I
tried adding code to delete VTK objects manually through
someVTKObject.Delete() but that didn't seem to help. I ran
jvisualvm but haven't been able to identify what is causing
the leak. I am relatively new to VTK (and jvisualvm), so I
wonder if there is a general strategy to address the memory
leak issue, or other potential issues that I should look
for.<br>
Thanks,<br>
Jim<br>
_______________________________________________<br>
Powered by <a moz-do-not-send="true"
href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a
moz-do-not-send="true"
href="http://www.kitware.com/opensource/opensource.html"
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a
moz-do-not-send="true"
href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a moz-do-not-send="true"
href="http://markmail.org/search/?q=vtkusers"
target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a moz-do-not-send="true"
href="http://public.kitware.com/mailman/listinfo/vtkusers"
target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
James Labiak
JSL Engineering and Software
6545 Lainhart Rd.
Altamont, NY 12009
Phone: 518-861-1113
Mobile: 231-638-3725
email: <a class="moz-txt-link-abbreviated" href="mailto:jim@jslengineeringsoftware.com">jim@jslengineeringsoftware.com</a></pre>
</body>
</html>