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

Bill Lorensen bill.lorensen at gmail.com
Fri Jan 10 08:51:40 EST 2014


I just compiled and ran your program with valgrind.
No leaks at all.

What OS are your running? What compiler version? What version of VTK?

we run valgrind every night on vtk's test suite. We do have to pro dive
suppressions for some rendering false alarms. But your simple program does
not need and suppressions.

Bill

On Jan 10, 2014 8:10 AM, "Liesbeth Vanherpe" <liesbeth.vanherpe at gmail.com>
wrote:

> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140110/96708f1e/attachment.htm>


More information about the vtkusers mailing list