Hello All,
I have been receiving a memFullError after measuring voltages after a very long time. The following problem can be reproduced using the following code.
I am basically doing a measurement of all of the channels in the beginning and printing out to the screen the memory usage on the current PC. Over time you can see the variable "ulPercentLoad" goes from whatever it started at (for example 45%) until 99% and then I receive this fatal runtime error. The function that actually does the communication with the SCXI Chassis is called SCXI_ReadAllChannels();. This function is also pasted below.
Code to reproduce Problem:
do
{
SCXI_ReadAllChannels();
iNumOfReads++;
Fmt(cString, "");
Fmt(cDateString, "");
if (GetCurrentDateTime(&dTime) >= 0)
{
FormatDateTimeString(dTime,"%I:%M:%S%p %A, %B %d, %Y",cDateString,sizeof(cDateString));
Fmt(cString, "%s<%s\nMeasurement #%i", cDateString, iNumOfReads);
CVIDynamicMemoryInfo(cDateString, &uiAllocBlocks,
&uiAllocBytes, DYNAMIC_MEMORY_SHOW_ALLOCATED_MEMORY_SUMMARY);
Fmt(cString, "%s[a]<\n\nCVI Dynamic Memory
Info:\nAllocated Bytes: %i[u]\nAllocated Blocks: %i[u]", uiAllocBytes,
uiAllocBlocks);
GetMemoryInfo(
&ulPercentLoad, &ulTotalPhysical,
&ulTotalPageFile, &ulTotalVirtual, &ulAvailablePhysical,
&ulAvailablePage,
&ulAvailableVirtual);
Fmt(cString, "%s[a]<\n\nWindows Memory Info:\nPercent
Load: %i[u]\nTotal Physical: %i[u]\nTotal Page File: %i[u]\nTotal
Virtual: %i[u]\nAvailable Physical: %i[u]\nAvailable Page:
%i[u]\nAvailable Virtual: %i[u]\n",
ulPercentLoad, ulTotalPhysical, ulTotalPageFile, ulTotalVirtual, ulAvailablePhysical,
ulAvailablePage, ulAvailableVirtual);
DoorsAction(cString);
DoorsFile(ADD, 1);
}
ProcessSystemEvents();
}
while (TRUE);
This is the function that does the actual measuring of the voltages and stores them in a global double array that is called dVoltageReading.Function definition:
double
dVoltageReading[320]; //Global
int CVIFUNC SCXI_ReadAllChannels (void)
{ //input : none
//output: dVoltageReading[320] = array of the voltage of all scxi channels
// 1 = success
// 0 = Scan_Op failure
// -1 = Scale failure
short chasis = 1;
int iNumberOfChannels = iNumOfModules[0] * 32;
short piOnDevChan[2] = {0};
short piOnDevGain[2] = {1};
short piBuffer[2880] = {0};
short mean_buffer_short[1440] = {0};
int ret, i, k, m;
ret = SCAN_Op(MIO, 1, piOnDevChan, piOnDevGain, piBuffer, /*iNumberOfChannels*2*/640, 100000.0, 0.0);
if(ret < 0)
{
//if ret is less than 0, scan_op returned an error
return 1;
}
i = 0;
for (m=0; m<2; m++)
{
for (k=0; k < iNumberOfChannels; k++)
{
mean_buffer_short[k] += piBuffer[i];
i++;
}
}
for (k=0; k<320; k++)
{
mean_buffer_short[k] /= 2;
}
// ret = SCAN_Demux(piBuffer, 320, 320, 0);
ret =
SCXI_Scale(1, 1, 0, 0.1, 1.0, MIO, 0, 1, /*64 192*/320, mean_buffer_short, dVoltageReading);
if(ret < 0)
{
return -1;
}
//reset everything
// ret = SCXI_MuxCtr_Setup(MIO, 0, 0, 0);
// ret = Timeout_Config(MIO, -1);
return 0;
}
As you can see, this function is not too complicated. All that we are doing in this function is performing the communication with the chassis, getting the values, and scaling them.
Inside of this function, the problem ALWAYS happens in the SCXI_Scale function.
Has anyone seen this problem before or can anyone please give some advice as to how I can resolve this problem?
We are using CVI 8.0.1 with NI-DAQ version 7.1.0f1 on a Windows XP machine with 2GB of memory.
Any help would be greatly appreciated. 🙂
Regards,
Dan Bracciano