MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / allocate

Method allocate

extern/libcds/cds/os/alloc_aligned.h:151–159  ·  view source on GitHub ↗

allocate array of \p nCount elements The address returned is aligned by \p nAlign boundary. \p nAlign parameter should be power of 2. The function guarantees the alignment for first element of array only. To guarantee the alignment for each element of the array the size of an object of type \p T must be multiple of \p nAlign: \code

Source from the content-addressed store, hash-verified

149 In no memory situation the function throws \p std::bad_alloc exception.
150 */
151 pointer allocate( size_type nAlign, size_type nCount )
152 {
153 assert( cds::beans::is_power2( nAlign ));
154 pointer p = reinterpret_cast<T *>( cds::OS::aligned_malloc( sizeof(T) * nCount, nAlign ));
155 if ( !p )
156 CDS_THROW_EXCEPTION( std::bad_alloc());
157 assert( cds::details::is_aligned( p, nAlign ));
158 return p;
159 }
160
161 /// allocate array of \p nCount elements, ignore hint
162 /**

Callers 15

MichaelHashSetFunction · 0.45
MichaelHashSetFunction · 0.45
MichaelHashMapFunction · 0.45
MichaelHashMapFunction · 0.45
MichaelHashMapFunction · 0.45
MichaelHashSetFunction · 0.45
alloc_spaceMethod · 0.45
heap_allocMethod · 0.45
MichaelHashSetFunction · 0.45
MichaelHashSetFunction · 0.45
MichaelHashSetFunction · 0.45
allocate_tableMethod · 0.45

Calls 5

assertClass · 0.85
is_power2Function · 0.85
is_alignedFunction · 0.85
aligned_mallocFunction · 0.50
allocateFunction · 0.50

Tested by

no test coverage detected