vtkRenderWindow memory leak

I suppose it was this issue: https://gitlab.kitware.com/vtk/vtk/-/issues/19268 ?

The content of your issue seems unrelated to the discussion here.

@Paulo_Carvalho I did not follow the whole discussion but this looks like misuse to me, not an issue, am I missing something ?

Hello, Mathieu,

Yes, it can be a misuse, but I believe the API should quit with at least a failed assert or pop up one of those VTK messages so the user knows s/heā€™s doing it wrong. An abend is not a good response to misuse in my opinion.

regards,

PC

Ok, @Zachary_Stamler , could you explain that issue ? because right now the name of the issue: ā€œvtkRenderWindow loop instantiation results in many open windowsā€ does not fit with an abort when incorrectly using the API.

Well I am a researcher and engineer, not a computer scientist, so perhaps Iā€™m fuzzy on the distinction. What happens is simply that windows keep opening and memory keeps allocating to the point where the entire system becomes unresponsive, though the the memory is actually not being utilized fully according to htop, so it could be the bottleneck is somewhere else, maybe in the graphics engine.

Iā€™m unclear on the meaning of your response to the bug report. Doesnā€™t a window interactor necessitate a user to manually close the window? This would make it impossible, or anyhow impractical, to render a series of images in a loop, no? EDIT FOR CLARIFICATION: what is needed is a way to leave a very long process running, possibly for hours, that is able to generate a series of images, for later review, without any user interaction.

If there is a good thorough primer on this somewhere Iā€™d love a link to it, as none of these usage conventions/requirements are at all clear or obvious trying to work from class documentation or from examples.

Hello,

An interactor is an interpreter of userā€™s gestures (e.g. dragging ā†’ rotate). Although not strictly necessary, the presence of an interactor seems to be a requirement, even if it does nothing.

I donā€™t see any problems with that. You can perfectly make animations loops in VTK regardless of window interactor. Actually, you can interact with the scene while the animation is running.

You donā€™t need to get rid of the interactor for it. You can apply transforms (e.g. rotate, translate, etc.) to the model/scene while capturing the screen in a loop.

I recommend perusing the VTK primer so you get acquainted with how VTK works: VTK Textbook | VTK . If you canā€™t afford the time to read, please, take a look at the examples for a more hands-on experience: https://examples.vtk.org/site/ .

regards,

PC

1 Like

Hi again Paulo,

Thank you so much for the link, Iā€™ll have a look.

Unfortunately what Iā€™m after is not so much animations where the perspective on an existing surface is dynamically changed, but rather a series of images to evaluate the performance of an algorithm that modifies the data in discrete steps. In other words, the data is modified with a certain parameter, the scene rendered and output as a file, then the data is modified again with a different parameter, etc etc. So it is necessary, as far as I can tell, to generate a new scene with every step.

I do find the requirement for an interactor odd. I guess VTK is more oriented towards generating animations or interactive scenes, but for someone who just needs to use the geometric algorithms and generate images, this is not such a friendly idiom, even though the library is quite capable of doing everything Iā€™m asking of it.

Thanks again for your attention and advice on this.

-Z