This issue exists in SDK 15.2 and earlier.
In nrf_log_frontend_dequeue() when memobj cannot be allocated, the backend flush api is used to free memory. However this memory gets immediately consumed by a log WARNING log "Backends flushed" which seems counterproductive. It would be better to set a flag and report the flush at a later time such as when the buffer is empty.
This is the problematic code:
//Could not allocate memobj - backends are not freeing them on time.
nrf_log_backend_t const * p_backend = m_log_data.p_backend_head;
//Flush all backends
while (p_backend)
{
nrf_log_backend_flush(p_backend);
p_backend = p_backend->p_cb->p_next;
}
//logging while dropping logs is counter-productive.
NRF_LOG_WARNING("Backends flushed");