PublishQueueAsyncRK and retain memory size left

Hi,

i’ve a Project that will use PublishQueueAsyncRK library, but my concern is about Retain memory.
As there is only 3068 byte available (2048 defined by default to the library) buffer to store the published data i wanted to know if there is a possibility to keep track of current retained memory available.

i searched if there is a way to find the retained memory free but seems not.
Someone proposed to keep track of what is stored in this memory and calculate the free mem. But i cannot figure out how to do that using the PublishQueueAsyncRK.

Any idea ?

regards,

Nico

@nmorisod, the PublishQueueAsyncRK library will NOT exceed the 2048 bytes allocated out of retained memory unless you specify to use more. Therefore, you are left with 1020 bytes to store other variables. You will need to manually calculate how you consume the rest of the retained RAM. One trick is to put all your variables in a struct and then in your setup() code, print the sizeof() that struct.

3 Likes