Instrument Control (GPIB, Serial, VISA, IVI)

Showing results for 
Search instead for 
Did you mean: 

Error connecting to textronix instrument with NI-VISA (Insufficient system resources to perform neccesary memory allocation)


I am using the NI-VISA .net driver in Visual Studio C# to create a program that can communicate with a MSO4104B Tektronix oscilliscope.

Sometimes, whenever I try to start a MessageBasedSession with the oscilliscope, I will get the following error shown in the picture below.

In the picture below, I'm using the Simple

ReadWrite.2015 code that is included as example code for the NI-VISA driver. I'm attaching this

example code to this post. I think this issue might start whenever I try to connect to the same oscilliscope via command prompt 

(ping *ip address of scope*) or start a telnet session with the scope (telnet *ip address* *port*) at the same time my visual studio program

is running. However, even when I close all windows and restart my computer and oscilliscope, this issue will still persist for a while and then

sometimes randomly work another day.



Does anybody have any idea for how to debug this or what the issue could be?


Here are some pictures of the references added to my project:



Additionally, here's a snippet of the code I'm using in my actual program to start a session

with the oscilliscope. I have a mbsession.close() statement in my code, but it's not always called 

because sometimes I exit the program early before all the code is finished. Could this be a potential 




Some other important debugging information I got was from NI MAX and NI I/O. When this

issue occurs, I can no longer see the oscilliscope ip address on NI MAX.

I also used NI I/O trace to debug this issue a little more and got this output. I got an error

code whenever viOpen(*ip address*) was called. The error status was 0xBFFF003C which I

think means "Insufficient system resources to perform necessary memory allocation".

Anybody knows what this could mean? I have about 5 GB of memory so I think it should 

be fine.



0 Kudos
Message 1 of 2

1. may check the latest firmware of oscilloscope.

2. it may get into trouble while the exception of the mbSession was not created. 


if(mbSession != null)



Good luck!

0 Kudos
Message 2 of 2