Microsoft KB Archive/195930

= Memory Usage by MS-DOS Application Steadily Increases =

Article ID: 195930

Article Last Modified on 10/31/2006

-

APPLIES TO


 * Microsoft Windows NT Workstation 3.51
 * Microsoft Windows NT Workstation 4.0 Developer Edition
 * Microsoft Windows NT Server 3.51
 * Microsoft Windows NT Server 4.0 Standard Edition
 * Microsoft Windows NT Server 4.0 Enterprise Edition

-



This article was previously published under Q195930



SYMPTOMS
Memory usage by any MS-DOS application that repeatedly calls the functions _dos_findfirst or _dos_findnext may continue to grow until the application quits. When you view the working set or private bytes using a diagnostic tool such as Performance Monitor, the size may steadily increase over time.



CAUSE
MS-DOS applications run on Windows NT under the Windows NT Virtual DOS Machine (NTVDM) subsystem. Each time an MS-DOS application calls the _dos_findfirst API, memory is allocated by the NTVDM and is used to keep the necessary search context information needed to handle subsequent calls to _dos_findnext. This memory is not deallocated until the directory search is complete or the process ends. The amount of memory allocated for each _dos_findfirst request varies based on the version of Windows NT, but is in the range of 1 KB to 2 KB for each request.



RESOLUTION
The only way the NTVDM can be sure a directory search has completed is when either _dos_findfirst or _dos_findnext returns non-zero, which indicates no matching entry. Applications should be written to finish each search, or the application can be rewritten as a 32-bit application. Under Win32, the functions FindFirstFile and FindNextFile replace the functions _dos_findfirst and _dos_findnext respectively. The Win32 function FindClose is provided to deallocate all related memory when the search handle is no longer required.

Additional query words: ntee ee console memory

Keywords: kbprb KB195930

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.