I do not have access to either system with a UI (I have only command line linux).<div>1. Is there anyway to test it on Windows?</div><div>2. Can you try running it and see if you get the same memory issues?<br><br><div class="gmail_quote">
On Tue, Apr 10, 2012 at 5:44 AM, Cory Quammen <span dir="ltr"><<a href="mailto:cquammen@cs.unc.edu">cquammen@cs.unc.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The code you've provided looks reasonable. If you wait a while, does<br>
the memory usage go down eventually?<br>
<br>
Do you have access to a Linux machine or a Mac? If so, valgrind should<br>
show you were the memory leak is coming from.<br>
<br>
Cory<br>
<div><div class="h5"><br>
On Tue, Apr 10, 2012 at 12:00 AM, Jonathan Morra <<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>> wrote:<br>
> I posted this a while ago and got no response. Does anyone else see this<br>
> problem? Is there more information that I can provide?<br>
><br>
><br>
> ---------- Forwarded message ----------<br>
> From: Jonathan Morra <<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>><br>
> Date: Tue, Mar 27, 2012 at 8:10 AM<br>
> Subject: Memory leak<br>
> To: VTK Mailing List <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
><br>
><br>
> I posted this problem before, but got no response. I've slightly modified<br>
> my test program to illustrate the problem more clearly. Specifically, when<br>
> I run the below code on Windows 7 compiled with MSVC 2008 in 32 bit with Qt<br>
> 4.7.4 and VTK pulled from git master on March 5, 2012, I get a pretty<br>
> pronounced memory leak. As I mouse over the image, then memory in the<br>
> Windows Task Manager climbs. If I comment out the imageViewer->Render();<br>
> line then the memory stays constants.<br>
><br>
> Can someone please<br>
> 1. Verify that they see this on their machine as well<br>
> 2. Provide a way to fix it.<br>
><br>
> Thanks<br>
><br>
> #include <QtGui/QApplication><br>
><br>
> #include <QMainWindow><br>
><br>
> #include <QVTKWidget2.h><br>
><br>
> #include <vtkImageViewer2.h><br>
><br>
> #include <vtkImageData.h><br>
><br>
> #include <vtkPointData.h><br>
><br>
> #include <vtkGenericOpenGLRenderWindow.h><br>
><br>
> class MyQVTKWidget2 : public QVTKWidget2 {<br>
><br>
> public:<br>
><br>
> MyQVTKWidget2 (vtkImageViewer2 *imageViewer, QWidget *parent = 0) :<br>
> QVTKWidget2(parent) {<br>
><br>
> this->imageViewer = imageViewer;<br>
><br>
> }<br>
><br>
> virtual ~MyQVTKWidget2() {<br>
><br>
> imageViewer->Delete();<br>
><br>
> }<br>
><br>
> void mouseMoveEvent(QMouseEvent *) {<br>
><br>
> for (int i=0; i<1000; ++i) {<br>
><br>
> // Comment out these lines to see the memory stay constant<br>
><br>
> imageViewer->Render();<br>
><br>
> }<br>
><br>
> }<br>
><br>
> private:<br>
><br>
> vtkImageViewer2 *imageViewer;<br>
><br>
> };<br>
><br>
> int main(int argc, char *argv[]) {<br>
><br>
> QApplication a(argc, argv);<br>
><br>
> vtkImageData *imageData = vtkImageData::New();<br>
><br>
> imageData->SetExtent(0, 100, 0, 100, 0, 100);<br>
><br>
> imageData->SetOrigin(0, 0, 0);<br>
><br>
> imageData->SetSpacing(1, 1, 1);<br>
><br>
> imageData->AllocateScalars();<br>
><br>
> imageData->GetPointData()->GetScalars()->FillComponent(0, 0);<br>
><br>
> vtkImageViewer2 *imageViewer = vtkImageViewer2::New();<br>
><br>
> imageViewer->SetInput(imageData);<br>
><br>
> MyQVTKWidget2 *widget = new MyQVTKWidget2(imageViewer);<br>
><br>
> imageViewer->SetRenderWindow(widget->GetRenderWindow());<br>
><br>
> QMainWindow mainWindow;<br>
><br>
> mainWindow.setGeometry(200, 200, 300, 300);<br>
><br>
> mainWindow.setCentralWidget(widget);<br>
><br>
> mainWindow.show();<br>
><br>
> imageData->Delete();<br>
><br>
> return a.exec();<br>
><br>
> }<br>
><br>
><br>
> Here is the Qt .pro file as well if it helps<br>
><br>
><br>
> #-------------------------------------------------<br>
><br>
><br>
> #<br>
><br>
> # Project created by QtCreator 2012-02-24T13:30:58<br>
><br>
><br>
> #<br>
><br>
> #-------------------------------------------------<br>
><br>
> QT += core opengl gui<br>
><br>
><br>
><br>
> TARGET = QVTKWidget2Test<br>
><br>
> CONFIG += console<br>
><br>
> CONFIG -= app_bundle<br>
><br>
> TEMPLATE = app<br>
><br>
><br>
> SOURCES += main.cpp<br>
><br>
> LIBS += -L../../vtk/lib -lvtkCommon -lvtksys -lQVTK\<br>
><br>
><br>
> -lvtkViews -lvtkWidgets -lvtkInfovis -lvtkRendering -lvtkGraphics<br>
> -lvtkImaging -lvtkIO -lvtkFiltering\<br>
><br>
><br>
> -lvtklibxml2 -lvtkDICOMParser -lvtkpng -lvtkpng -lvtktiff -lvtkzlib<br>
> -lvtkjpeg -lvtkalglib -lvtkexpat\<br>
><br>
><br>
> -lvtkverdict -lvtkmetaio -lvtkNetCDF -lvtksqlite -lvtkexoIIc -lvtkftgl<br>
> -lvtkfreetype -lvtkHybrid\<br>
><br>
><br>
> -lvtkVolumeRendering<br>
><br>
> INCLUDEPATH += ../vtk/include<br>
><br>
><br>
><br>
><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>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Cory Quammen<br>
Research Associate<br>
Department of Computer Science<br>
The University of North Carolina at Chapel Hill<br>
</font></span></blockquote></div><br></div>