<div dir="ltr"><div><div><div><div><div><div>Dear mailing list,<br><br></div><div><br>I'm running into a problem involving vtkSmartPointer and valgrind complaints.<br><br></div>Here is a minimal code example of what doesn't seem to work:<br>
<br></div><div>======== main.cpp ===========<br></div><div>#include <vtkSmartPointer.h><br>#include <vtkDataSetMapper.h><br><br>int main(int argc, char ** argv)<br>{<br> vtkSmartPointer<vtkDataSetMapper> dataSetMapper = vtkSmartPointer<vtkDataSetMapper>::New();<br>
<br> return 0;<br>}<br>======== CMakeLists.txt ===========<br>cmake_minimum_required(VERSION 2.8)<br>project(main)<br><br>set(CMAKE_BUILD_TYPE Debug)<br>set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")<br>
<br>find_package(VTK REQUIRED)<br>include(${VTK_USE_FILE})<br><br>add_executable(main main.cpp)<br><br>target_link_libraries(main ${VTK_LIBRARIES})<br>======================<br><br></div>Both cmake and compiling run fine. Next, when I run "valgrind --leak-check=full ./main", there are plenty of messages about "possibly lost" blocks.<br>
</div><br></div>When I replace "vtkDataSetMapper" by e.g. "vtkIdList", valgrind has no complaints. When I replace "vtkDataSetMapper" by "vtkRenderWindow", valgrind gives me similar error messages.<br>
<br></div><div>I have installed VTK 5.8.<br></div><div><br></div>What am I missing?<br><br><br></div>Regards,<br><br>Liesbeth Vanherpe<br></div>