Max variable/array size


#1

Hi, I’d like to implement a byte array like this:

byte buffer[4500];

When using 3500 entries the compiler runs OK and looking at the little info icon 20% of the RAM size is used. But when using 4500 entries the compiler complains saying `.bss’ will not fit in region RAM’.

Is there a possibility to go with 4.5k bytes?
Thanks in advance!


#2

There is only 4,096 bytes of RAM available in the user app.

The nrf51822 has 32K RAM, however the SoftDevice (BLE stack) consumes 8K of that, leaving us 24k.

The system firmware of bluz consumes the rest, and a very large chunk of that is used to perform the initial encryption necessary for the Particle handshake. The RSA encryption uses malloc and consumes nearly 10-12k of RAM, but only when the handshake happens. Because of that, we need to leave the block empty and only use it when the device connects.

Unless there are some ways in the future to perform the RSA encryption differently, it is unlikely we will be able to increase the user RAM size.


#3

Ok thanks. Then I will find a workaround to resume with a slightly smaller array size. :wink: