I have written a test application to help isolate the source of the problem::
=========================================
#include "stdafx.h"
#include "watchdog.h"
extern "C" __declspec(dllimport) void GwesPowerOffSystem();
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
SYSTEMTIME time;
double * eatMems[100];
char * charPtr = NULL;
int lastTime=0;
int i = 0;
// eat memory up so there is a smaller pool to play with
do
{
eatMems[i] = new double[100000];
} while (eatMems[i++] != NULL);
while (1)
{
if (charPtr != NULL)
{
delete [] charPtr;
charPtr = NULL;
}
// allocate a new array, mixing up sizes to represent real-world conditions better
int memAmt = (int)(((double)rand())/((double)RAND_MAX + 1.0))* 100000;
charPtr = new char[150000 + memAmt];
// attempt to write to buffer
strcpy(charPtr, "FILLER DATA");
MEMORYSTATUS memInfo;
memInfo.dwLength = sizeof(memInfo);
GlobalMemoryStatus(&memInfo);
GetLocalTime(&time);
RETAILMSG(1, (TEXT("GMS:%02d/%02d/%d-%2d:%02d:%02d %d,%d,%d,%d,%d,%d\r\n"), time.wMonth, time.wDay, time.wYear, time.wHour, time.wMinute, time.wSecond, memInfo.dwTotalPhys, memInfo.dwAvailPhys, memInfo.dwTotalVirtual, memInfo.dwAvailVirtual, memInfo.dwTotalPageFile, memInfo.dwAvailPageFile));
int thisTime = time.wHour*60 + time.wMinute;
// check for 3 minutes going by as a way to exit app to avoid turning system into a brick
if ( (lastTime > 0) && ((thisTime - lastTime) > 1) )
{
exit(0);
}
else
{
lastTime = thisTime;
}
RETAILMSG(TRUE,(L"Entering Suspend..."));
GwesPowerOffSystem();// suspend
RETAILMSG(TRUE,(L"...Exiting Suspend\r\n"));
}
return 0;
}
=========================================
I run this on the BitsyXb and use a Function generator to wake up the BitsyXb every 5 seconds. After about 24 hours the unit crashes. Looking at the dump of available memory I see:
To me this conclusivly indicates that there is a memory leak in the sleep/wake cycling. This leak does not appear to be there when we do not wake/sleep. On our systems we sleep/wake every 10 minutes rather than 5 seconds so the timescale of the crash is much longer. In reality I am seeing the same memory profile and a crash after 88 days of sleep/wake every 10 minutes.
If Eurotech can confirm this issue independantly it would be greatly appreciated. We would also like to know if there is any possibilty for a fix or if we need to re-engineer our use so that the system resets periodically to avoid the crash.