NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

system.out of memory exception

I am running a TestStand sequence, using the .NET adaptor I am creating a class, and calling methods of a Class Library I created in VB.NET. I tested my class library in VB.NET and everything works in that environment. The sequence I call is pretty simple,

 

  1. create an instance of my class, then
  2. call a method that setups and initializes a camera
  3. call a method that runs through the tests of a test sequence

The first pass of the sequence, it runs, the second pass of the sequence, whether in a For loop or the entire TestStand Sequence started again, it initializes the camera, but the second sequence, TestStand reports a system.out of memory exception in an underlying assembly/dll of my dll. But, when I call my dll from a .exe I made to test my dll, it works fine.

 

Thanks

 

 

 

0 Kudos
Message 1 of 10
(6,142 Views)

Hi mobiux,

 

In the exe you made, are you executing the assembly multiple times in the same execution?  It seems like the problem may be relating to the fact that you are opening references to the camera without closing them, then attempting to initialize again.  When running the assembly in TestStand, the camera references will not be closed unless your code does so specifically, so make sure that a close step is implemented in your dll.  Let me know if there is anything else I can do to help!

Al B.
Staff Software Engineer - TestStand
CTA/CLD
0 Kudos
Message 2 of 10
(6,124 Views)

Thanks for you reply.

 

I am calling the setup and initialization of the camera once; it is the calling the method that runs a sequence of tests that I am repeating calls to and subsequently failing on the second call. The interesting thing is if I close out of TestStand completely after the first run. Then run my TestStand sequence again, it reportsd the same error. It seems something is not being released, or cleared, or something. Keep in mind, I am only getting this with TestStand, I do not get it when I run a test .exe that calls my dll. I since have tested calling my .exe in TestStand that calls my DLL and that works. The problem is clearly in using TestStand to create the class and call the methods.

 

Thanks

0 Kudos
Message 3 of 10
(6,107 Views)

Are any of your objects disposable or required to be cleaned up before things can run again? You might want to check if the objects you are using support IDispose and if so call Dispose() on them when you are done with them. Also what version of TestStand are you using. Also if you can reproduce this in a simple case please post the code here.

 

Hope this helps,

-Doug

0 Kudos
Message 4 of 10
(6,070 Views)
If you are using very large camera buffers, it could be that your address space doesn't have large enough contigious free spaces left once you include TestStand in the process, even though there might be plenty of total memory. You could try smaller buffers/images and make sure no buffer or image is allocated longer than necessary. Also, you might check out the /3gb option mentioned in thise thread: http://forums.ni.com/ni/board/message?board.id=330&message.id=19441&query.id=695882#M19441
Message 5 of 10
(6,065 Views)
Thanks for your replies. I changed the resolution of the camera from full resolution to 1/2 resolution by binning, and now it runs without errors in TestStand indicating a Memory issue. My computer has 4G ram, camera is 2048x3096, I reviewed the suggested Memory Tuning, and have spoken to the 3rd party assemblies developer and thay are reviewing it from there end to see if they take advantange of the 3G - switch large array option. Waiting on further input from tech support since it works outside of TestStand as if there is anything that can be done within TestStand, since the error is genereated when using TestStand.
0 Kudos
Message 6 of 10
(6,033 Views)

The reason is doesn't work in TestStand is because when you combine the allocations you make with those that TestStand makes (which includes loading every system DLL TestStand depends on), you run out free address ranges that are large enough for your buffers. There is not much to do about that. You could try using one of the example User Interface applications instead of the sequence editor. If you are willing to go minimalist, use the CVI or MFC simple UI examples. Even those could be paired down by cutting out the Report control so the IE doesn't get loaded into your process. You could also make sure you aren't enabling database logging, since that will probably load quite a few extra dlls.

Message 7 of 10
(6,030 Views)

...also, I'm not sure what you are waiting to hear from the provider of your assembly about using the /3gb switch. According to the MS documentation, you setup that switch on your machine and then you use their editbin utility to make sure that the IMAGE_FILE_LARGE_ADDRESS_AWARE bit is set in the executable file you run, which would probably be the sequence editor or whichever UI you use.

Message 8 of 10
(6,027 Views)

 

In the documentation on the Memory Tuning, it said that some manufacturers preconfigure to use the Memory tuning, they were going to see if they are or not. I will try using the stripped down UI, and the Editbin.util.to modify the header. Thanks again, very much appreciated, will keep you posted.

0 Kudos
Message 9 of 10
(6,020 Views)
My reading of the documentation is that the flag is in the .exe you create your process with, which for the TestStand case would probably be seqedit.exe or userinterface.exe, not the .net assembly you are calling, which is probably a DLL.  I doubt we set that flag for seqedit.exe or any of the user interface examples, so you would probably need to use editbin.exe.
0 Kudos
Message 10 of 10
(6,013 Views)