Problem : fault error on a Win32 service application running on a W 2003 X64 OS
Server: DELL PowerEdge 2850,Processor Intel EM64T 3GHz, with 13,3 RAM physical memory available
OS: Windows 2003 Standard x64 Edition
The server is dedicated to our software
It is a search engine for Intranets, made of a classical dll (NoeBase.dll) running as a Windows service under the NoeService.exe application.
Both programs have been developed on Visual Studio 6 as Win32 projects which have worked well on 32bit W2003 with 2 GB or RAM, till they ran on a memory problem when indexing more than a certain amount of documents (say 200,000).
We decided to port it to a WIN64 project under Visual Studio 2005, to run them on the above DELL server.
Since we had a tight schedule, we chose to take a first step by recompiling both programs under Visual Studio 2005 as Win32 projects, linking them with /LARGEADDRESSAWARE setting in order to be able to use up to 4 GB of RAM.
NoeBase is located on C:\Windows\SysWOW64
NoeBase starts by allocating a heap of 128 MB, and reallocates the heap with chunks of more memory when needed.
The NoeService application works well but runs into an error, as follows (DrWatson message)
"The application, NoeService.exe, generated an application error
The exception generated was c0000005 at address 7D611952 (ntdll!ExpInterlockedPopEntrySListFault)"
This error terminates the service.
From our app log file, the problem occurred in our function which reallocates the heap by calling HeapReAlloc
Pointer ResizeMem (Pointer AddrLpMem, indeX size)
return deRef(AddrLpMem) = HeapReAlloc(_g_MemHeap, HEAP_GENERATE_EXCEPTIONS,
_g_MemHeap is a global handle obtained by call to GetProcessHeap()
Pointer is a void * type, and indeX an unsigned long type.
AddLpMem is the pointer to the block to reallocate.
deRef is a macro: #define deRef(P) (*(Pointer *)(P))
The problem occurs when the Commit Charge is about 1,4 GB (of which approximately 900 MB used by NoeService).
Questions : How to prevent the error, either at the code level, or at the system level ?
This is a very important problem for us, and I am willing to give a high level of points.