This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C66x OpenCL hostcode Malloc issue

Version of MCSDK - MCSDK_HPC_03_00_01_08
Processor and board platform (EVM & its revision) - Hawking chip Evaluation Board EVMK2H Rev 3.0.

API - OpenCL 1.1, no CSL

Hello everyone,

While writing the hostcode for the OpenCL I have faced an malloc issue:

spmv: malloc.c:2451: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.

Aborted

It only happens when I am trying to allocate certain amount of memory: if allocate much more or much less, that will work (in this particular code it fails to allocate 180 bytes). I am definitely not going outside of the allocated memory, in fact I deleted all the code touching that memory and left printf statement printing out the returned address (so optimizer won't cancel malloc out).