Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 5 months ago.
mbed OS 5 Mail::caaloc
Mail::calloc() returns with NULL even the the Queue is not full!
I use a mailbox using mbed Mail class as :
CapturedFrame *_pCapturedFrame; Mail<CapturedFrame, 8> _frameQueue;
In a TimeOut handler function I terminate the current received frame with :
rc = _frameQueue.put(_pCapturedFrame), which Returns allways with osOK! A Background thread will process this Frame and frees up the Memory block using :
rc = _frameQueue.free(pFrame), which Returns allways with osOK!
After calling Mail::put I setup my Frame pointer with a next Frame from my Memorypool as:
_pCapturedFrame = _frameQueue.calloc();
With low load it works, but when I send multiple Frames faster, then I get a NULL pointer back! I check the Queue Status, but Queue is not full - but also not empty. I tried to encapsulate with 'mbed_critical_section', nothing changed! I incrased the number of Mail entries, but this will only shift the Event some Frames later, but still happens! I would understand the returned NULL pointer when the Queue is full (means also I calloc all my Memory packets from pool), but only returning NULL I do not know what happens!
Are there any issues known?
Many Thanks