Code Monkey home page Code Monkey logo

Comments (12)

jhlegarreta avatar jhlegarreta commented on September 27, 2024

At first sight, all instances seem to stem from 3D Slicer proper; not sure how this can be tracked better. Let me know if you have some insight on this @jcfr @lassoan @jamesobutler. Thanks.

from slicerdmri.

lassoan avatar lassoan commented on September 27, 2024

If no memory leaks are detected without running your script, and memory leak is reported if running your script then the root cause is most likely that your script created an object without taking ownership or incremented reference count without later decrementing it. See some more information here: https://slicer.readthedocs.io/en/latest/developer_guide/advanced_topics.html#factory-methods

If it is not obvious what allocation caused the leak then you can use VTK memory leak debugging infrastructure:

https://slicer.readthedocs.io/en/latest/developer_guide/debugging/tips.html#debugging-memory-leaks

from slicerdmri.

jhlegarreta avatar jhlegarreta commented on September 27, 2024

👍 Thanks for commenting Andras.

https://slicer.readthedocs.io/en/latest/developer_guide/advanced_topics.html#factory-methods
https://slicer.readthedocs.io/en/latest/developer_guide/debugging/tips.html#debugging-memory-leaks

Interesting. Thanks for the pointers.

I'll have a better look as time permits. Thinking out loud, running a dynamic analysis tool on SlicerDMRI may be helpful.

from slicerdmri.

jhlegarreta avatar jhlegarreta commented on September 27, 2024

Attempt in PR #216 unsuccessful.

Trying to use USE_VTK_DEBUG_LEAKS:BOOL=ON () for SlicerDMRI and setting the

"environment": [{"VTK_DEBUG_LEAKS_TRACE_CLASSES": "vtkMRMLMultiVolumeRenderingDisplayNode"}],

in the VS Code launch.json does not print any line where the leak comes from.

from slicerdmri.

lassoan avatar lassoan commented on September 27, 2024

You need to build VTK with USE_VTK_DEBUG_LEAKS enabled.

from slicerdmri.

jhlegarreta avatar jhlegarreta commented on September 27, 2024

You need to build VTK with USE_VTK_DEBUG_LEAKS enabled.

OK. I see this now: https://github.com/Slicer/Slicer/blob/6e3288a1a0abe19576d81ba78703709e55bc4df8/CMakeLists.txt#L269

I assume this requires 3D Slicer and the extension at issue to be compiled in Debug mode, right?

from slicerdmri.

pieper avatar pieper commented on September 27, 2024

I assume this requires 3D Slicer and the extension at issue to be compiled in Debug mode, right?

No, I think this works either way.

from slicerdmri.

lassoan avatar lassoan commented on September 27, 2024

I think you need at least RelWithDebInfo mode to see method names and line numbers (and have the ability to debug into the code if the stack trace is not obvious enough). Debug mode makes line-by-line debugging easier (lines are executed in order, local variables are not opimized out) but execution can be much slower.

from slicerdmri.

pieper avatar pieper commented on September 27, 2024

It looks to me that USE_VTK_DEBUG_LEAKS is independent of build type. It just reports any instances there are with non-zero reference counts so it shouldn't need any symbols.

from slicerdmri.

lassoan avatar lassoan commented on September 27, 2024

VTK is much smarter now. It can record the stack trace of all allocations of a given class. On exit, it can print all those stack traces that belong to leaked objects. Stack trace may need symbols.

from slicerdmri.

pieper avatar pieper commented on September 27, 2024

Ah, okay, yes, that sounds helpful. It never used to do that.

from slicerdmri.

jhlegarreta avatar jhlegarreta commented on September 27, 2024

OK, thanks both for the insight.

from slicerdmri.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.