Unit 'Exec' Package
[Overview][Constants][Types][Procedures and functions][Variables][Index] [#aros]

AllocVec

Allocate memory and keep track of the size

Declaration

Source position: exec.pas line 1325

function AllocVec(

  ByteSize: LongWord;

  Requirements: LongWord

):Pointer;

Arguments

ByteSize

  

The size of the desired block in bytes. (The operating system will automatically round this number to a multiple of the system memory chunk size)

Requirements

  

If no flags are set, the system will return the best available memory block. For expanded systems, the fast memory pool is searched first. (MEMF_*)

Function result

A pointer to the newly allocated memory block. If there are no free memory regions large enough to satisfy the request, nil will be returned. The pointer must be checked for zero before the memory block may be used!

Description

Allocate a memory block and record its size, FreeVec() knows how many bytes to free.

Memory is allocated based on requirements and options. Any "requirement" must be met by a memory allocation, any "option" will be applied to the block regardless. AllocMem will try all memory spaces until one is found with the proper requirements and room for the memory request.

See also

FreeVec

  

Free memory with tracked size made using AllocVec()

Exec.ExecAllocMem

  

Allocate memory given certain requirements


Documentation generated on: 2021-07-30