Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 3/22/2024
Public
Document Table of Contents

Malloc

Allocates memory aligned to 64-byte boundary.

Syntax

Case 1: Memory allocation for blocks of 32-bit length

Ipp8u* ippsMalloc_8u(int len);

Ipp16u* ippsMalloc_16u(int len);

Ipp32u* ippsMalloc_32u(int len);

Ipp8s* ippsMalloc_8s(int len);

Ipp16s* ippsMalloc_16s(int len);

Ipp32s* ippsMalloc_32s(int len);

Ipp64s* ippsMalloc_64s(int len);

Ipp32f* ippsMalloc_32f(int len);

Ipp64f* ippsMalloc_64f(int len);

Ipp8sc* ippsMalloc_8sc(int len);

Ipp16sc* ippsMalloc_16sc(int len);

Ipp32sc* ippsMalloc_32sc(int len);

Ipp64sc* ippsMalloc_64sc(int len);

Ipp32fc* ippsMalloc_32fc(int len);

Ipp64fc* ippsMalloc_64fc(int len);

Case 2: Memory allocation for platform-aware functions

Ipp8u* ippsMalloc_8u_L(IppSizeL len);

Ipp16u* ippsMalloc_16u_L(IppSizeL len);

Ipp32u* ippsMalloc_32u_L(IppSizeL len);

Ipp8s* ippsMalloc_8s_L(IppSizeL len);

Ipp16s* ippsMalloc_16s_L(IppSizeL len);

Ipp32s* ippsMalloc_32s_L(IppSizeL len);

Ipp64s* ippsMalloc_64s_L(IppSizeL len);

Ipp32f* ippsMalloc_32f_L(IppSizeL len);

Ipp64f* ippsMalloc_64f_L(IppSizeL len);

Ipp8sc* ippsMalloc_8sc_L(IppSizeL len);

Ipp16sc* ippsMalloc_16sc_L(IppSizeL len);

Ipp32sc* ippsMalloc_32sc_L(IppSizeL len);

Ipp64sc* ippsMalloc_64sc_L(IppSizeL len);

Ipp32fc* ippsMalloc_32fc_L(IppSizeL len);

Ipp64fc* ippsMalloc_64fc_L(IppSizeL len);

Include Files

ipps.h

Flavors with the _L suffix: ipps_l.h

Domain Dependencies

Headers: ippcore.h, ippvm.h

Libraries: ippcore.lib, ippvm.lib

Parameters

len

Number of elements to allocate.

Description

This function allocates memory block aligned to 64-byte boundary for elements of different data types.

NOTE:
Not aligned memory allocation could cause not reproducible performance and precision results.

Example

The following example shows how to use theippsMalloc_8u function:

void func_malloc(void) 
{    
    Ipp8u* pBuf = ippsMalloc_8u(8*sizeof(Ipp8u));
    if(NULL == pBuf)
      // not enough memory

    ippsFree(pBuf); 
}

Return Values

The return value of ippsMalloc is a pointer to an aligned memory block. If no memory is available in the system, then the NULL value is returned. To free this block, use the ippsFree function.

See Also