LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to clear python memory that has been called for several iteration?

Hi my name is Leo,

I have this project about YOLO detection that i've been working on and i had to call out python code from labview. Long story short it was successful, but the problem is that i had to call out this python script in every iteration which caused the memory to pile up and eventually crash on my computer. I've read some of the QnA here and there that some use shift registration and other use new data value reference then delete the data value reference. I'm not sure how to apply those function here

Leonard555_0-1695091702289.png

The picture above is part of my big project and caused the memory to pile up.

Leonard555_1-1695092070553.png

the picture above is the result of the run which pile up the memory

Is this because of the python code or do i need to add a function in labview
what do you guys think?

sincerely
Leo

0 Kudos
Message 1 of 5
(1,450 Views)

for a start, I would try to move the"open virtual environment session.vi" and  "close python session" outside of the while loop

 

Spoiler
alexderjuengere_0-1695114595975.png
Message 2 of 5
(1,401 Views)

Hello Alex

 

I've tried that it works but it only works for the first time but not for the next iteration 😞 is there a way to erase the python memory?

0 Kudos
Message 3 of 5
(1,366 Views)

@Leonard555 wrote:
is there a way to erase the python memory?

Is this because of the python code or do i need to add a function in labview
what do you guys think?


As far as I know there is no "release memory" function available for the labview python node.

 

But if your .vi is piling up resources - increasing each while loop iteration - there is probably room for optimization in the .vi and/or the .py

 

 

 

 

0 Kudos
Message 4 of 5
(1,337 Views)

I see, thank you for the suggestion alex. ill try to work on the .vi and the .py. But if there is another solution, feel free to share.

Cheers, 

Leo

0 Kudos
Message 5 of 5
(1,321 Views)