# How to create a memory leak in Ignition?

**URL:** <https://forum.inductiveautomation.com/t/how-to-create-a-memory-leak-in-ignition/44039>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [March 3, 2021, 1:37pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-memory-leak-in-ignition/44039 "2021-03-03T13:37:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [March 3, 2021, 1:37pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-memory-leak-in-ignition/44039/1 "2021-03-03T13:37:02Z")

</div>

Might sound like a weird question but I think it can be informative. Inspired when I was reading this thread - [https://stackoverflow.com/questions/6470651/how-can-i-create-a-memory-leak-in-java](https://stackoverflow.com/questions/6470651/how-can-i-create-a-memory-leak-in-java)

Ignition uses jython and normally handles threading on its own unless told otherwise, so the ways described in the above post aren’t obvious how you would do them in an Ignition program. What are the ways that Ignition developers can create a memory leak in our scripting or design decisions, so that we know what to avoid or refactor?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [March 3, 2021, 2:13pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-memory-leak-in-ignition/44039/2 "2021-03-03T14:13:00Z")

</div>

One that comes to mind would be a long-lived async thread. As @pturmel has mentioned on more than one occasion, you need to interrupt and replace/merge the thread when calling it a second time to prevent creating more than a single instance.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 3, 2021, 2:29pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-memory-leak-in-ignition/44039/3 "2021-03-03T14:29:09Z")

</div>

> [@Ignition server memory increasing](http://forum.inductiveautomation.com/t/ignition-server-memory-increasing/43932/4):
>
> Firing off async threads without a means to kill off. A single jython async thread stuck in an infinite wait or infinite loop will hold the entire old interpreter in memory after a scripting restart. Opening python sockets without try-finally guards to close. Attaching python listeners to java infrastructure with no way to remove/retire. Caching python objects without control over lifetimes. All of the above are prone to happen regularly as projects are edited and scripts are restarted (pe…
