[vtkusers] Valgrind complains when using vtkSmartPointer, depending on which object is created

Liesbeth Vanherpe liesbeth.vanherpe at gmail.com
Fri Jan 10 08:10:02 EST 2014


Dear mailing list,


I'm running into a problem involving vtkSmartPointer and valgrind
complaints.

Here is a minimal code example of what doesn't seem to work:

======== main.cpp ===========
#include <vtkSmartPointer.h>
#include <vtkDataSetMapper.h>

int main(int argc, char ** argv)
{
    vtkSmartPointer<vtkDataSetMapper> dataSetMapper =
vtkSmartPointer<vtkDataSetMapper>::New();

    return 0;
}
======== CMakeLists.txt ===========
cmake_minimum_required(VERSION 2.8)
project(main)

set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")

find_package(VTK REQUIRED)
include(${VTK_USE_FILE})

add_executable(main main.cpp)

target_link_libraries(main ${VTK_LIBRARIES})
======================

Both cmake and compiling run fine. Next, when I run "valgrind
--leak-check=full ./main", there are plenty of messages about "possibly
lost" blocks.

When I replace "vtkDataSetMapper" by e.g. "vtkIdList", valgrind has no
complaints. When I replace "vtkDataSetMapper" by "vtkRenderWindow",
valgrind gives me similar error messages.

I have installed VTK 5.8.

What am I missing?


Regards,

Liesbeth Vanherpe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140110/ca620709/attachment.htm>


More information about the vtkusers mailing list