"ERR: Failed to allocate snapshot buffer" with FOMO

Hi everyone, I’m trying to process object detection on ESP-32 Cam Wrover.

After uploading the Arduino Library on the Arduino IDE and runing the “esp32_cam” sketch from the examples, I get this error :

ERR: Failed to allocate snapshot buffer! coming from this :

#define EI_CAMERA_RAW_FRAME_BUFFER_COLS           320
#define EI_CAMERA_RAW_FRAME_BUFFER_ROWS           240
#define EI_CAMERA_FRAME_BYTE_SIZE                 3
      // check if allocation was successful
    if(snapshot_buf == nullptr) {
        ei_printf("ERR: Failed to allocate snapshot buffer!\n");

Project ID: 174736

My peak ram usage is only 4Kb, I can’t figure what’s the problem…

Anyone could help with this ? Than you

I do not know how much RAM the ESP-32 Cam Wrover has but where do you see Peak RAM usage as 4kiB. It takes 320 x 240 x 3 = 230.4kiB RAM to store the image that is a mere 57 times the reported Peak RAM usage.

I suggest reducing the Impulse Input Data Block to maybe 96x96.

1 Like


What @MMarcial suggests is correct. It must be that the size of your model + snapshot buffer is more RAM than is currently available on the ESP-32 Cam Wrover.

Unfortunately the 4kB Peak RAM usage is incorrect and I’ll create a ticket. Thanks for reporting

The ESP-32 is supposed to have 8MB of RAM, how is not this enough ?

After changing Impulse Data Block to 48x48 and those lines :

#define EI_CAMERA_RAW_FRAME_BUFFER_COLS           320
#define EI_CAMERA_RAW_FRAME_BUFFER_ROWS           240
#define EI_CAMERA_FRAME_BYTE_SIZE                 3

By those lines :

#define EI_CAMERA_RAW_FRAME_BUFFER_COLS           48
#define EI_CAMERA_RAW_FRAME_BUFFER_ROWS           48
#define EI_CAMERA_FRAME_BYTE_SIZE                 3

This is what I get in the serial monitor :

Edge Impulse Inferencing Demo
Camera initialized
Starting continious inference in 2 seconds...
Guru Meditation Error: Core  1 panic'ed (LoadStoreError). Exception was unhandled.
Core 1 register dump:
PC      : 0x400df772  PS      : 0x00060430  A0      : 0x80100f75  A1      : 0x3ffb1c60  
A2      : 0x3ffc8784  A3      : 0x40000044  A4      : 0x000003c0  A5      : 0x00000010  
A6      : 0x00000008  A7      : 0x3ffc4d64  A8      : 0x00000000  A9      : 0x00000002  
A10     : 0x00000072  A11     : 0x40000044  A12     : 0x00000030  A13     : 0x000378c0  
A14     : 0x00038400  A15     : 0x00000000  SAR     : 0x00000000  EXCCAUSE: 0x00000003  
EXCVADDR: 0x40000044  LBEG    : 0x40089854  LEND    : 0x40089870  LCOUNT  : 0x00000000  

ELF file SHA256: 0000000000000000

Backtrace: 0x400df772:0x3ffb1c60 0x40100f72:0x3ffb1c80 0x40061b1b:0x3ffb1ca0 0x400e4823:0x3ffb1d20 0x400df6d5:0x3ffb1de0 0x400df7d9:0x3ffb1e10 0x400d2478:0x3ffb1e50 0x400d3173:0x3ffb1e70 0x400dba85:0x3ffb1fb0 0x4008c44e:0x3ffb1fd0

ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
mode:DIO, clock div:1
ho 0 tail 12 room 4
entry 0x400806b4

After using Esp Exception Decoder, I get this information :

What did I do wrong ?

Is it ok to set my Impulse Data Block to 48x48 with the MobileNetV1 96x96 0.1 ?

No, you should not change the
values, unless you also change .frame_size in camera_config. So just leave them as is and try to run your impulse.
Do you have PSRAM enabled?

According to this discussion on the espressif forum , the ESP32 Wrover automatically set the PSRAM to “enable”. Could you confirm that ?

Anyway, when selecting the module ESP32-CAM Wrover module on the Arduino IDE, no option allows me to enable or not the PSRAM :


When putting back the RAW_FRAME_BUFFER to their initials values, I got the same error again :

ERR: Failed to allocate snapshot buffer!

Any idea ?


Can you try to use the ESP32 Dev Module as the board?
Let me know if that works



when training the model, what dimensions did you set if the size of the pre-training was large, this may not fit

Have you been able to resolve the issue?


I solved the problem just by updating the version of Arduino IDE.

Sometimes it is just that simple :man_shrugging:t3:
Thanks for all the people that helped me with this !


Hello, I hope you can help me, which version did you update to remove the error?
“ERR: Failed to allocate snapshot buffer", I have the latest version installed and I cannot solve the problem

1 Like

hi there,

if you are still experiencing issues, please go to the block that looks like this:

#define EI_CAMERA_RAW_FRAME_BUFFER_COLS           320
#define EI_CAMERA_RAW_FRAME_BUFFER_ROWS           240
#define EI_CAMERA_FRAME_BYTE_SIZE                 3


96 worked for me.

kind regards,
rey malahay