LayerAS_Layer
ObjectMemory_Allocation

Memory allocation object.



Method Summary
 Method
 
void ASfree(void* ptr)
Frees the specified memory block.
 
void* ASmalloc(os_size_t nBytes)
Allocates and returns a pointer to a memory block containing the specified number of bytes.
 
void* ASrealloc(void* ptr, os_size_t newNBytes)
If possible, extends the given block and simply returns ptr. Otherwise, it allocates a new block of newNBytes bytes, copies the contents from the old pointer into the new block, frees the old pointer, and returns the pointer to the new block. If a new block cannot be allocated, the call fails and ptr is not freed. Reallocating a block to a smaller size will never fail.




Method Detail
ASfree()
Product availability: All
Platform availability: All

Syntax

void ASfree(void* ptr)

Frees the specified memory block.

Parameters

ptr — 

IN/OUT The block of memory to free.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00020000

File: ASProcs.h
Line: 115
ASmalloc() 
Product availability: All
Platform availability: All

Syntax

void* ASmalloc(os_size_t nBytes)

Allocates and returns a pointer to a memory block containing the specified number of bytes.

Parameters

nBytes — 

IN/OUT The number of bytes for which space is allocated.

Returns

A pointer to the allocated memory, NULL on failure.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00020000

File: ASProcs.h
Line: 86
ASrealloc() 
Product availability: All
Platform availability: All

Syntax

void* ASrealloc(void* ptr, os_size_t newNBytes)

If possible, extends the given block and simply returns ptr. Otherwise, it allocates a new block of newNBytes bytes, copies the contents from the old pointer into the new block, frees the old pointer, and returns the pointer to the new block. If a new block cannot be allocated, the call fails and ptr is not freed. Reallocating a block to a smaller size will never fail.

Parameters

ptr — 

IN/OUT The existing memory block.

 
newNBytes — 

IN/OUT The number of bytes the memory block must be able to hold.

Returns

A pointer to memory block.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00020000

File: ASProcs.h
Line: 105