Export (0) Print
Expand All

_amblksiz

Controls memory heap granularity. This global variable has been deprecated in Visual C++ 2005 for the more secure functional versions _get_amblksiz and _set_amblksiz, which should be used in place of the global variable. It is declared in Malloc.h as:

extern unsigned int _amblksiz;

The value of _amblksiz specifies the size of blocks allocated by the operating system for the heap. The initial requested size for a segment of heap memory is just enough to satisfy the current allocation request (for example, a call to malloc) plus memory required for heap manager overhead. The value of _amblksiz should represent a trade-off between the number of times the operating system is to be called to increase the heap to the required size and the amount of memory potentially wasted (available but not used) at the end of the heap.

The default value of _amblksiz is 8K. You can change this value by using the set function in your program. For example:

_set_amblksiz(2045);

If you assign a value to _amblksiz, the actual value used internally by the heap manager is the assigned value rounded up to the nearest whole power of 2. Thus, in the previous example, the heap manager would reset the value of _amblksize to 2048.

Community Additions

ADD
Show:
© 2014 Microsoft