Microsoft KB Archive/254727

= PRB: Running an Optimized Executable File Appears to Leak Disk Cache =

PSS ID Number: 254727

Article Last Modified on 10/16/2002

-

The information in this article applies to:


 * Microsoft Windows 98 Second Edition

-



This article was previously published under Q254727



SYMPTOMS
By default, all executable files that are compiled and linked with Microsoft Visual Studio 6.0 include an optimization for Windows 98 that sets the file alignment at 4 KB instead of the previous alignment of 512 bytes. This results in a larger module size, but one that loads faster and with reduced page swapping on Windows 98.

On Windows 98 Second Edition, executing a file that includes this optimization and that resides on a local drive results in an apparent leak in the disk cache size when the process exits. This is not an actual leak, as the memory is reclaimed by the system if it is needed.



MORE INFORMATION
The Windows 98 file alignment optimization can be suppressed by using the /OPT:NOWIN98 linker switch.

Even without the optimization, a process appears to leak disk cache if it loads a dynamic-link library (DLL) that has the optimization. The Microsoft C-Runtime (CRT) and the Microsoft Foundation Class (MFC) libraries both have this optimization.

The apparent leak can be observed by using the Windows 98 System Monitor tool to watch the Disk Cache Size counter. Because disk cache is charged against the system, the apparent leak can also be observed in the Allocated Memory counter, or programmatically through successive calls to the GlobalMemoryStatus API function.

