KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q47766: _amblksiz Affects Memory Allocation in Near and Far Heaps

Article: Q47766
Product(s): See article
Version(s): 5.10   | 5.10
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | docerr | mspl13_c
Last Modified: 16-AUG-1989

The documentation on Page 33 of the "Microsoft C for the MS-DOS
Operating System: Run-Time Library Reference" states that adjusting
the value of the global variable _amblksiz has no effect on halloc or
_nmalloc() in any memory model.

This statement in the manual is incorrect. In fact, _amblksiz is used
to determine how much to expand both the near heap and the far heap
segments, and is used by calls to _nmalloc(). The only difference
between calls to _nmalloc() and _fmalloc is that _nmalloc() doesn't
actually request memory from DOS, it takes it from the pre-allocated
heap (in DOS).

However, since the the memory allocated by a call to halloc() is
maintained independently of the near and far heaps, the value of
_amblksiz does not affect calls to halloc().

The default value of _amblksiz is 8K (8192) bytes. The variable is
declared in malloc.h. For more information about the use of _amblksiz,
refer to the "Microsoft C for the MS-DOS Operating System: Run-Time
Library Reference," Section 3.2.

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.