IPB

> Heap variables (System unit)
Чат
Форум
Загрузка...
 

Language:
Русский
English

  Heap variables     (System unit)


 HeapBlock, HeapError, HeapLimit, and HeapList, HeapAllocFlags, HeapEnd,

HeapOrg, HeapPtr

The heap manager uses HeapList, HeapLimit, HeapBlock, and HeapError to implement dynamic memory allocation routines.

The HeapLimit variable defines the threshold between "small" and "large" heap blocks. The HeapBlock variable defines the size the heap manager uses when allocating blocks assigned to the sub-allocator.

You should have no reason to change the values of HeapLimit and HeapBlock, but should you decide to do so, make sure that HeapBlock is at least 4 times the size of HeapLimit.

HeapError variables contain the address of a heap error function,which gets called whenever the heap manager cannot complete an allocation request.

HeapError is a pointer that points to a function with this header:

    function HeapFunc (Size: Word): Integer; far;

The heap error function is installed by assigning its address to the HeapError variable as follows:

    HeapError := @HeapFunc;

The heap error function gets called whenever a call to New or GetMem cannot complete the request.

The Size parameter contains the size of the block that could not be allocated, and the heap error function should attempt to free a block of a least that size.

Before calling the heap error function, the heap manager attempts to allocate the block within its sub-allocation free space as well as through a direct call to the Windows GlobalAlloc function.

The HeapError function returns

  ■ 0 to indicate failure, and causes a run-time error to occur immediately.
  ■ 1 to indicate failure, and causes New or GetMem to return a nil pointer.
  ■ 2 to indicate success, and causes a retry (which could also cause
    another call to the heap error function).

HeapAllocFlags is used with gmem_Moveable.

HeapEnd, HeapOrg, HeapPtr are pointers to the heap end, origin and pointer, respectively.

Heap variables for Windows

  HeapList
  HeapLimit
  HeapBlock
  HeapAllocFlags
  HeapError

Heap variables for real mode

  HeapEnd
  HeapOrg
  HeapPtr
  HeapError

Heap variables for protected mode

  HeapList
  HeapLimit
  HeapBlock
  HeapAllocFlags

 
 К началу страницы 
 

Код для вставки: :: :: :: ГОСТ ::
Поделиться: //
 



-
Хостинг предоставлен компанией "Веб Сервис Центр" при поддержке компании "ДокЛаб"