Universal Robots Forum

Program node clean up?

Hello I tried starting a timer thread when the program node is instantiated,
It will run forever when switching to another .urp file or running an empty program, this will lead to memory leak, so the node must still be alive?
Is there a way do a clean up when a program node isn’t in use anymore?
Im not talking about openView and closeView to handle timer threads.

1 Like

you can override the finalize method of the node, but that code will not be executed when you want (it depends on the JVM’s garbage collector).

I’ve had some problems with this too for other use cases (for example, the node doesn’t know when the user deletes it). I could also use a better solution than overriding finalize; if someone has it, it is very welcome.

2 Likes