NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Exception of Type 'System.OutofMemoryException' was thrown

I am trying to run test software developed using TestStand 2010 SP1 and LabVIEW 2011 SP1 on a Windows XP machine. We have generated common sequences in TestStand that are called from a custom script language. The test runs for about 2.5 hours before throwing an error, "Exception of Type 'System.OutofMemoryException' was thrown." It happens at about the same point each time, but not always during the same Sequence or VI call.

 

Our software does loop quite a bit calling the same TestStand sequence multiple times. And we are saving data samples read from test equipment into arrarys to analyze, but would that array not be written over each time rather than allocating new memory for each call? Or could it be generating a new memory allocation for each time the TestStand sequence is called?

 

Any other ideas on why we would be getting an out of memory exception only when we run the entire test consecutively(>2.5hours), meaning if we run it in two halfs(tests 1-5 then terminate, then restart and run tests 6-10) it works fine?

0 Kudos
Message 1 of 6
(6,548 Views)
0 Kudos
Message 2 of 6
(6,539 Views)

So if I call a subsequence that loops 100 times and builds up a 1D array of 100 elements, then it creates memory for this array each time I call the subsequence, or does the array memory location just get overwritten? The above article talks about large loops whereas I have a smaller loop that I call multiple times. Just trying to understand how the memory is allocated in this situation.

 

0 Kudos
Message 3 of 6
(6,534 Views)

By default, TestStand collects results for every step you run into a variable called Locals.ResultList[] (subsequence results are chained into the parents Locals.ResultList[]). If you loop over many steps over a long period of time you are potentially saving millions of results in memory. You can disable result collection for steps you don't want to record results for in several ways:

 

1) On each step you can disable results for that step. For steps with the loop setting enabled you can specify whether or not to record all results for all loops, or only the final result.

2) On the sequence properties dialog you can disable results for that sequence (overrides the step setting).

3) For the entire station you can disable result collection in the station options dialog if you are not using TestStand result processing mechanisms.

 

Hope this helps,

-Doug

0 Kudos
Message 4 of 6
(6,530 Views)

I have already modified the sequence properities to disable results for each of my sequences, so I don't think that is the issue. But if I call a sequence that has a local array variable multiple times without unloading the sequence am I multiplying my memory usuage which could be the cause of my out of memory exception? Or is the memory that the local vaiable is stored in overwritten each time the sequence is entered?

 

0 Kudos
Message 5 of 6
(6,524 Views)

No, the local variables only exist while the sequence is running (unless you are leaking references to them in your code modules). So you should only have as many versions of the locals in memory as you have actively running versions of the sequence. You might have a lot of actively running versions though, I have no idea what your sequences look like.

 

How much memory is the process using as reported in Task Manager? Are you trying to allocate a large block of memory such as a large array? As memory becomes more fragmented and used more, it becomes harder to allocate large blocks of memory in 32-bit programs due to the limitation of the address space (i.e. it's hard to find a contiguous block of address space large enough). You might be hitting this issue.

 

The general approach I'd recommend for you is to try to figure out what is using most of the memory and try to optimize that to use less memory. Also avoid trying to allocate very large blocks. Once your process is using about 1 gig of ram, it becomes difficult to allocate blocks bigger than 100meg in a 32-bit process.

 

Since you are getting a .NET out of memory exception, another possibility is that you have an issue with garbage collection or are leaking .NET objects (i.e. unintentionally holding a reference to them somewhere keeping them from being garbage collected). You can call GC.Collect() before doing something memory intensive and see if that helps. If you don't have .NET code modules though, then this is likely not the problem.

 

-Doug

Message 6 of 6
(6,521 Views)