The allocate() function

Allocates the specified amount of memory and returns it.

Syntax

The function has the following syntax:
virtual void *allocate(const size_t sz, bool array=false)

Description

The function allocates memory from the heap specific to the SPUPad type (file-backed or shared memory). The only size restriction is the amount of available heap memory. Instead of using the allocate() function to allocate memory, review the PAD_NEW macro, which can help you to make the allocations and also manage constructors for you. Use the allocate() function only if you are using C-style code and want to replace calls to malloc/calloc instead of calls to new.

Throws

The function throws an exception if it cannot allocate the memory.