KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q216383: Memory Allocations May Fail When There Are Large Free Blocks

Article: Q216383
Product(s): Microsoft Windows NT
Version(s): winnt:4.0,4.0 SP1,4.0 SP2,4.0 SP3,4.0 SP4
Operating System(s): 
Keyword(s): kbWinNT400sp5fix
Last Modified: 20-MAY-2002

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Windows NT Server versions 4.0, 4.0 SP1, 4.0 SP2, 4.0 SP3, 4.0 SP4 
- Microsoft Windows NT Workstation versions 4.0, 4.0 SP1, 4.0 SP2, 4.0 SP3, 4.0 SP4 
- Microsoft Windows NT Server, Enterprise Edition versions 4.0, 4.0 SP4 
- Microsoft Windows NT Server versions 4.0, 4.0 SP4, Terminal Server Edition 
-------------------------------------------------------------------------------

SYMPTOMS
========

Memory allocations may return "Out of Memory" errors even when there are large
free blocks of memory available within the virtual address space of the process.

CAUSE
=====

Heap allocations within a process may result in the memory manager having to
extend the heap using virtual memory to satisfy the request. The memory manager
extends the heap by allocating contiguous virtual memory from the process
address space. By default, the memory manager requests double the previous
successfully allocated heap segment. If it fails allocating virtual memory for a
larger heap segment, it does not try to allocate a segment the size of the
previous or smaller segments.

For example, if the previous successfully allocated heap segment was 64 MB, the
heap manager will attempt to extend the heap by 128 MB if it needs to extend the
heap. If there is not 128 MB of contiguous virtual memory, the allocation to
extend the heap will fail and the heap allocation will subsequently fail even
though there may have been another 64-MB free block.

RESOLUTION
==========

To resolve this problem, obtain the latest service pack for Windows NT 4.0 or
the individual software update. For information on obtaining the latest service
pack, please go to:

- http://www.microsoft.com/Windows/ServicePacks/

-or-

- Q152734 How to Obtain the Latest Windows NT 4.0 Service Pack

For information on obtaining the individual software update, contact Microsoft
Product Support Services. For a complete list of Microsoft Product Support
Services phone numbers and information on support costs, please go to the
following address on the World Wide Web:

  http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS


STATUS
======

Microsoft has confirmed this to be a problem in Microsoft Windows NT version
4.0. This problem was first corrected in Windows NT version 4.0 Service Pack 5.

MORE INFORMATION
================

Ntdll was fixed so that, if Ntdll.dll cannot extend the heap because of an "Out
of Memory" error on a first attempt, it divides the requested virtual memory
allocation size by 2 and will continue to attempt to extend the heap in this way
until the size requested falls below what is needed to satify the heap
allocation.

Additional query words: 4.00 c0000017

======================================================================
Keywords          : kbWinNT400sp5fix 
Technology        : kbWinNTsearch kbWinNTWsearch kbWinNTW400 kbWinNTW400search kbWinNT400search kbWinNTW400sp4 kbWinNTW400sp3 kbWinNTW400sp2 kbWinNTW400sp1 kbWinNTSsearch kbWinNTSEntSearch kbWinNTSEnt400sp4 kbWinNTSEnt400 kbWinNTS400sp4 kbWinNTS400sp3 kbWinNTS400sp2 kbWinNTS400sp1 kbWinNTS400search kbWinNTS400 kbNTTermServ400 kbNTTermServ400sp4 kbNTTermServSearch
Version           : winnt:4.0,4.0 SP1,4.0 SP2,4.0 SP3,4.0 SP4
Hardware          : ALPHA x86
Issue type        : kbbug
Solution Type     : kbfix

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.