Arduino+ESP-FACE Crash after face detection because of calls to free()

timothyp
Posts: 5
Joined: Thu Feb 27, 2020 3:53 am

Arduino+ESP-FACE Crash after face detection because of calls to free()

Postby timothyp » Fri Feb 28, 2020 6:01 am

Hi,

I am using the default CameraWebServer.ino sample that comes with Arduino-ESP32.
It works and detects my face only to crash after that upon calling `free` (see code below)

If I simply disable the calls to free (which I know I probably really should not do)
then the app works fine.

Code: Select all

box_array_t *net_boxes = NULL;
if(detection_enabled){
    net_boxes = face_detect(image_matrix, &mtmn_config);
}
fr_face = esp_timer_get_time();
fr_recognize = fr_face;
if (net_boxes || fb->format != PIXFORMAT_JPEG){
    if(net_boxes){
        detected = true;
        if(recognition_enabled){
            face_id = run_face_recognition(image_matrix, net_boxes);
        }
        fr_recognize = esp_timer_get_time();
        draw_face_boxes(image_matrix, net_boxes, face_id);
        
        //This is where the app crashes
        free(net_boxes->score);
        free(net_boxes->box);
        free(net_boxes->landmark);
        free(net_boxes);
MJPG: 8000B 339ms (2.9fps), AVG: 309ms (3.2fps), 136+137+0+0=273 0
MJPG: 7123B 330ms (3.0fps), AVG: 308ms (3.2fps), 138+120+0+0=258 0
CORRUPT HEAP: Bad head at 0x3ffe2c34. Expected 0xabba1234 got 0x00000008
abort() was called at PC 0x400859b9 on core 1

ELF file SHA256: 0000000000000000000000000000000000000000000000000000000000000000

Backtrace: 0x4008df08:0x3ffe16e0 0x4008e185:0x3ffe1700 0x400859b9:0x3ffe1720 0x40085add:0x3ffe1750 0x400e74fb:0x3ffe1770 0x400e3401:0x3ffe1a30 0x400d63cc:0x3ffe1a80 0x40095c75:0x3ffe1ab0 0x40086aee:0x3ffe1ad0 0x400858f9:0x3ffe1af0 0x4000bec7:0x3ffe1b10 0x400d1f82:0x3ffe1b30 0x400dee95:0x3ffe1ce0 0x400df545:0x3ffe1d10 0x400df619:0x3ffe1da0 0x400dfa28:0x3ffe1dc0 0x400de0be:0x3ffe1de0 0x400de110:0x3ffe1e20 0x40093075:0x3ffe1e40

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10864
load:0x40080400,len:6432
entry 0x400806b8

timothyp
Posts: 5
Joined: Thu Feb 27, 2020 3:53 am

[SOLVED] Re: Arduino+ESP-FACE Crash after face detection because of calls to free()

Postby timothyp » Mon Mar 02, 2020 7:18 am

Turns out this can be sovled by using Arduino-ESP32 at commit 4638628873a061c36faffebe4d146d13f960076d (tag: 1.0.4)

Who is online

Users browsing this forum: No registered users and 150 guests