Memory Usage by MS-DOS Application Steadily Increases

ID: Q195930


The information in this article applies to:
  • Microsoft Windows NT Workstation versions 3.51, 4.0
  • Microsoft Windows NT Server versions 3.51, 4.0
  • Microsoft Windows NT Server, Enterprise Edition version 4.0


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 :
Version : WinNT:3.51,4.0
Platform : winnt
Issue type : kbprb


Last Reviewed: February 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.