Hi there... I've found a memory leak using visa VIs for controlling my PC serial port. I have a loop, with about 1sec cycle, tha call a subVI that communicate with the serial port: The sub VI do the following:
1. Open Serial Port Session 2. Set serial port parameters 3. Read (to empty buffer) 4. Write 5. Read answer 6. Close Visa Session
Each loop, the memory is increased of about 4k.... when I press the 'STOP' on my VI, it take some time (15 secs, depemds on how long the program ran) to release memory, and you can see the memory usage decreasing.
1st question. It is correct to open & close a VISA session for each single serial query?
2nd question There is a way to avoid this memory leak?
You haven't attached your VI but I suspect the memory leak is in in your program and not in Visa. To answer your first question, no it is not correct to open and close Visa for each query. In older versions of LabVIEW, you open Visa once at the beginning and do a close when done. In LabVIEW 6 and above, it's not necessary to explicitly open and close a VISA session. Your memory leak may be a result of opening a Visa session and then not closing it. The increase in memory could also be the result of what you are doing with the data you read. Are you building a string or an array?
On Tue, 29 Jan 2002 10:34:40 GMT, OldSmobile wrote:
Hem... I'm really sorry... the memory leak was causated by a wrong destruction of a control reference. It was subdole (the destruction was in place but not in the right position) Thanks to alla for the attenction.
P.S. If anybody wants to blame me: http://plz.dont.cut.my.head/ :-))