Memory Loss During Application Process Creation

This article was previously published under Q124121
This article has been archived. It is offered "as is" and will no longer be updated.
SYMPTOMS
An application which periodically starts Command Prompt commands orutilities (32-bit applications) may exhibit symptoms of a memory resourceallocation problem. To observe this problem, you can use PerformanceMonitor to view nonpaged pool memory. The application in question regularlyallocates more and more nonpaged pool memory until system memory resourcesare exhausted. This can result in poor system performance and disk"thrashing" (a condition where the hard disk drive is constantly beingaccessed, even in periods of little system activity).



The following error message may appear when system memory is finallyexhausted:
{DLL Initialization Failed} Initialization of the dynamic link library KERNEL32.DLL failed. The process is terminating abnormally. [(NTSTATUS) 0xC0000142L]


NOTE: The symptoms are not evident using the same application under WindowsNT version 3.1.
CAUSE
When an application spawns a process repeatedly, a new thread instance willbe created for each process but the previous instances may not be cleanedup. This results in a significant virtual memory loss each time the processis spawned. Executing the following Win32 calls will result in the samememory loss symptoms listed above.

   CreateProcess(anyprocess,...,............, &pi);   CloseHandle(pi.hProcess);   CloseHandle(pi.hThread);				


NOTE: If there is a WaitForInputIdle() call between CreateProcess() andCloseHandle(),the problem does not occur.
RESOLUTION
WINSRV.DLL was modified to correct this behavior. Even when processes arerepeatedly created by an application, WINSRV.DLL ensures that the processand thread handles are closed upon command.
STATUS
Microsoft has confirmed this to be a problem in Windows NT version 3.5.This problem was corrected in the latest U.S. Service Pack for Windows NTversion 3.5. For information on obtaining the Service Pack, query on thefollowing word in the Microsoft Knowledge Base (without the spaces):

   S E R V P A C K				
prodnt 3.50
Properties

Article ID: 124121 - Last Review: 12/28/2014 17:40:34 - Revision: 4.1

  • Microsoft Windows NT Workstation 3.5
  • Microsoft Windows NT Server 3.5
  • kbnosurvey kbarchive kbprb KB124121
Feedback