Hang on pvPortMalloc()

conkerkh wrote on Tuesday, December 20, 2016:

My application is crashing on pvPortMalloc at

configASSERT( ( ( ( size_t ) pxNewBlockLink ) & portBYTE_ALIGNMENT_MASK ) == 0 );
I double checked and there is still availble heap to allocate from, hwoever for some reason everything hangs at mentioned assert. I’m using heap_4 alloc scheme. Are there any particular reasons why this might be happening?

hs2sf wrote on Tuesday, December 20, 2016:

This assert doesn’t check for an exhausted heap, it checks that your allocator satisfies the alignment requirement of the processor achitecture used.
You should check check portmacro.h::portBYTE_ALIGNMENT and the resulting portable.h::portBYTE_ALIGNMENT_MASK vs. your allocator implementation.

conkerkh wrote on Tuesday, December 20, 2016:

I’ve checked it and it’s correct, I would assume in this case that newBlock (this is inside condition that splits blocks) is not aligned properly this condition occurs after several calls to pvPortMalloc. First few calls are ok but later on it hangs. To be honest I have no idea what’s going on. I would avoid using dynamic allocation but I have no other options in this case… Any ideas where to go next?

bowerymarc wrote on Tuesday, December 20, 2016:

make sure you’re not calling from an ISR (including timerTick)

On Dec 20, 2016, at 2:09 PMEST, Chris conkerkh@users.sf.net wrote:

I’ve checked it and it’s correct, I would assume in this case that newBlock (this is inside condition that splits blocks) is not aligned properly this condition occurs after several calls to pvPortMalloc. First few calls are ok but later on it hangs. To be honest I have no idea what’s going on. I would avoid using dynamic allocation but I have no other options in this case… Any ideas where to go next?

Hang on pvPortMalloc() https://sourceforge.net/p/freertos/discussion/382005/thread/ba211d48/?limit=25#29a7
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/freertos/discussion/382005/ https://sourceforge.net/p/freertos/discussion/382005/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/ https://sourceforge.net/auth/subscriptions/

conkerkh wrote on Wednesday, December 21, 2016:

I examined memory and turns out there was memory leak after writing to previously allocated memory. Which was the result of misalignment. Anyway thanks for help:)

hemant2007 wrote on Wednesday, February 01, 2017:

Hello Chris,
I am having same problem that you described.
How you have got rid of this ?
How to find memory leak?
How/why misalignment is created?

rtel wrote on Wednesday, February 01, 2017:

You can track memory allocations and frees using the FreeRTOS+Trace tool.