10-12-2010 03:25 PM
Hello,
I'm using Visa to talk to 488.2-compliant devices, typically using TCP/IP sockets. In recent testing it was shown that calls to the viStatusDesc() function are invariably resulting in 160 leaked bytes. This was first noticed when running the test program with IBM Rational PurifyPlus. The program was then rebuilt without Purify, and the Linux 'top' command showed that the virtual memory of the test process is indeed increasing.
Below is environment information, and a simple test program that results in the leaked bytes. The memory traces to hidden functions within Visa, so it seems like something under the hood is getting allocated and not cleaned up. Has anyone else seen these leaks on Linux?
NI Visa: 4.5.1
Linux: Redhat, 2.6.18-92.el5
Compiler: g++
#include <visa.h>
#include <iostream>
using namespace std;
int main (int argc, char *argv[])
{
cout << "Hello" << endl;
char resrcName[40];
if (argc < 2)
{
cout << "Usage: runTest <resourceName>" << endl;
return 1;
}
strcpy(resrcName, argv[1]);
ViSession myResrcMgr(0);
//***************************************************************************
//** Open the session to the default VISA resource manager.
//***************************************************************************
ViStatus status = viOpenDefaultRM(&myResrcMgr);
viStatusDesc(myResrcMgr, status, errBuf);
if (status != VI_SUCCESS)
{
cout << "Error: Failed to open VISA Resrc Mgr session."
<< "\n\tVISA ERROR: " << errBuf << endl;
return 1;
}
else
{
cout << "Opened Resrc Mgr successfully: "
<< errBuf << endl;
}
//***************************************************************************
//** Close the VISA resource manager.
//***************************************************************************
status = viClose(myResrcMgr);
if (status != VI_SUCCESS)
{
cout << "Error closing resource manager!" << endl;
return 1;
}
cout << "Close successful" << endl;
return 0;
}
Thanks in advance
- Dan
Solved! Go to Solution.
10-12-2010 03:34 PM
I believe this has already been fixed in NI-VISA 5.0. Please check the 'NI-VISA 5.0 improvements and bug fixes' in the NI-VISA 5.0 readme.txt at:
http://ftp.ni.com/support/softlib/visa/NI-VISA/5.0/linux/README.txt
11-07-2011 06:04 PM
You are correct. We (finally) upgraded to Visa 5.0 and the viStatusDesc() function no longer leaks.
Thanks
Dan