Hello,
I am running such code deliberately, it is allocating the buffer flawlessly until the 10th run (102*10 = 1020). After that, it gives 4 from the allocation function.
and as I am still filling 102 bytes by nrf_ringbuf_put function it is overflowing but not gives any error, yet it is starting to allocate 102 bytes after the 12nd cycle until the 21st cycle.
My expectation is it should run till the 10th cycle, then it should give memory full error continuously.
NRF_RINGBUF_DEF(testRingbuf,1024);
void testfunc(){
nrf_ringbuf_init(&testRingbuf);
len =102;
for(int i=0;i<20;i++){
nrf_ringbuf_alloc(&testRingbuf,&bufferAllocChunk,&len, true);
fillbuffer(bufferAllocChunk,len);
err_code = nrf_ringbuf_put(&ppgRingbuf, PPG_WATERMARK_BUFFER_SIZE);
}
}
One more detail ;
If I allocate and put bytes amount of two's power (ex:128,256,...) it works as intended(it gives "no-mem" error until freeing some space)
But if I allocate /put a number of bytes such as 102 or any other number other than two's power, the library gives a "no-mem" error once and it is overwriting. I don't know if we are able to allocate/put an arbitrary number of bytes or we need to put/allocate only two's power.