LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Having issue with memory leak in VISA serial write

I'm attaching a small vi that uses Visa to write and then read the serial port. If you highlight execution, and open the task manager, you can see that every time the VISA serial write executes it uses 8K of memory. This is on a Win2KSP3 box with LV6.1. Result of this is that top-level test exec crashes Windows every four or five days - What am I doing wrong?
0 Kudos
Message 1 of 4
(3,415 Views)
First make sure you are using the latest and greatest VISA version.

VISA is getting pretty smart these days. Part of this "smart-ness" may be getting in your way. Here is my point.

After each write/read action, you are closing the VISA session. I suspect that each time through the loop VISA is creating a new session in your behalf (this is the Smart-ness thing).

Try getting rid of the VISA close in the called sub-VI and only close the session AFTER the main loop completes.

Keep us updated if you get this figured out.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 4
(3,415 Views)
Mr. Bill:

You should remove the VISA Close if you are doing all of this in a loop. There is a bug in NI-VISA 2.6.0 with this exact memory leak. The following blurb is from the readme for NI-VISA 2.6.1:

"Opening and closing a serial port in a loop on Windows 2000/NT/XP would cause a memory leak."

Dan Mondrik
Senior Software Engineer, NI-VISA
National Instruments
0 Kudos
Message 3 of 4
(3,415 Views)
Dan,

Thanks for the tip. You were exactly right, and the vi's are running now for one week with no issue.

cheers,
Bill
0 Kudos
Message 4 of 4
(3,415 Views)