Stm32767zi Arduino platform - Fail to allocate memory

Hi ,

I’m doing an IOT camera project which take visual images and send it through MQTT protocol using JSON string .Usually the image size will vary from 25kb-75kb depend on image detail and resolution .I noticed that when the image size is more than 30kb it will not send the data to the MQTT function .When I tried to print the image data ,I don’t see any data after I encode the data using base64String .
However, the data will be send successfully when the image size is less than 30kb.

The sequence is ;
1:Read the data from the camera
(SnapLen= snapshot size taken by camera)

    for (uint32_t i = 0; i < snapLen; i++)
        buff[i] = myCAM->read_fifo();

2: Encode data using base64 String;

    encode_base64((byte *)buff, snapLen, (byte *)encoded);

3: Append the string to send it as a one file

   snapString += String(encoded);

4: publish data using mqtt client

I assume this is due to lack of memory allocation ,since after base64 encode and before append the image data an attempt was made to allocate memory but it failed and the data will be lost .However ,STM32-767 does have 512k RAM ,so I’m not sure ,what’s causing this .Although I use to run the similar code on Particle boards which uses STM32F205 and never had this issue .

So I’m not sure the memory allocation is limited by stm32duinio core or somewhere .

Appreciate your help.