10-14-2025 07:50 PM
I found that 'Open Python Session' causes a memory leak. Can anyone help me solve this problem?
Solved! Go to Solution.
10-15-2025 10:29 AM - edited 10-15-2025 10:30 AM
Does it do the same in a loop?
10-15-2025 10:35 AM
Does this leak 5 references or 1?
10-15-2025 07:48 PM
Yes, it's the same in a loop; every time the loop runs, there will be a memory leak.
10-16-2025 10:39 AM
@Wlison wrote:
Yes, it's the same in a loop; every time the loop runs, there will be a memory leak.
Hmm, under the hood LV has to launch a python interpreter instance and link to it. Not sure the details of how NI does that but I wonder if the external reference is the detected leak.
Without solving the issue of NI trace detecting a leak, perhaps you can code around it by only calling Open Python Session once for the lifetime of the LV app. Unless you really need multiple python interpreters its probably faster code to launch one and keep it open rather than spinning one up each time you need it.
10-17-2025 03:22 AM
It seems that there is no way to solve this problem, because calling the Python node will also cause a memory leak.
10-17-2025 04:43 AM
Jay wasn't talking about solving the problem but about mitigating it. Rather than open a new Python session over and over again, only do it once and then reuse it throughout the application lifetime.
Are you implying that every time the Call Python node is called it creates yet another memory leak?
10-19-2025 08:17 PM