[For complete, up-to-date TBB information visit: http://www.ThreadingBuildingBlocks.org]

TbbRef (Ver. 20): 5.2 scalable_allocator<T> Template Class

5.2 scalable_allocator<T> Template Class

Summary

Template class for scalable memory allocation.

Syntax

template<typename T> class scalable_allocator;

Header

#include "tbb/scalable_allocator.h"

Description

A scalable_allocator allocates and frees memory in a way that scales with the number of processors. A scalable_allocator models the allocator requirements described in Table 18. Using a scalable_allocator in place of std::allocator may improve program performance. Memory allocated by a scalable_allocator should be freed by a scalable_allocator, not by a std::allocator.

Members

See Allocator concept ( 5.1).

Acknowledgement

The scalable memory allocator incorporates McRT technology developed by Intel’s PSL CTG team.

5.2.1 C Interface to Scalable Allocator

Summary

Low level interface for scalable memory allocation.

Syntax

extern "C" {

void* scalable_calloc ( size_t nobj, size_t size );

void scalable_free( void* ptr );

void* scalable_malloc( size_t size );

void* scalable_realloc( void* ptr, size_t size );

}

Header

#include "tbb/scalable_allocator.h"

Description

These functions provide a C level interface to the scalable allocator. Each routine scalable_x behaves analogously to the C standard library function x. Storage allocated by a scalable_x function should be freed or resized by a scalable_x function, not by a C standard library function. Likewise storage allocated by a C standard library function should not be freed or resized by a scalable_x function.

[For complete, up-to-date TBB information visit: http://www.ThreadingBuildingBlocks.org]