# Program node clean up?

**URL:** <https://forum.universal-robots.com/t/program-node-clean-up/1038>\
**Category:** URCaps SDK\
**Created:** [August 7, 2017, 1:41pm UTC](https://forum.universal-robots.com/t/program-node-clean-up/1038 "2017-08-07T13:41:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon58840761](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@anon58840761](https://forum.universal-robots.com/u/anon58840761)\
**Post date:** [August 7, 2017, 1:41pm UTC](https://forum.universal-robots.com/t/program-node-clean-up/1038/1 "2017-08-07T13:41:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anon16416181](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@anon16416181](https://forum.universal-robots.com/u/anon16416181)\
**Post date:** [August 7, 2017, 1:47pm UTC](https://forum.universal-robots.com/t/program-node-clean-up/1038/2 "2017-08-07T13:47:49Z")

</div>

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.
