vroland / epdiy

EPDiy is a driver board for affordable e-Paper (or E-ink) displays.
https://vroland.github.io/epdiy-hardware/
GNU Lesser General Public License v3.0
1.25k stars 178 forks source link

Fix memory leak when deinitializing display feeder tasks #306

Closed vroland closed 1 month ago

vroland commented 2 months ago

Towards #269 .

vroland commented 2 months ago

@aceisace Can you check if this fixes the issue?

aceisace commented 2 months ago

@vroland Yes sure, but I'll need a few days before I can test this due to some refactoring that is required when using the latest version of epdiy

martinberlin commented 2 months ago

Looking good. Will test it tonight! -> UPDATE: It works good. Maybe for this one will be nice to make a test that draws the Dragon, and deinits epdiy everytime, and checks that the RAM usage is stable. Although no idea if it's so easy to implement something like this.

aceisace commented 1 month ago

@vroland Hey, I finally had time to test this out today, but sadly, it does not fix the issue. This is the error this time:

assert failed: lq_init line_queue.c:23 (queue.bufs != NULL)

Backtrace: ... 
0x400823f9: panic_abort at ../esp/v4.4.6/esp-idf/components/esp_system/panic.c:408
0x400926a9: esp_system_abort at ../esp/v4.4.6/esp-idf/components/esp_system/esp_system.c:137
0x40099e09: __assert_func at ../esp/v4.4.6/esp-idf/components/newlib/assert.c:85
0x400f78b9: lq_init at ../esp-idf/test/components/epdiy-main/src/output_common/line_queue.c:23 (discriminator 1)
0x400f6bf1: epd_renderer_init at ../esp-idf/test/components/epdiy-main/src/render.c:322
0x400f6949: epd_init at ../esp-idf/test/components/epdiy-main/src/epdiy.c:491
0x400e74d2: loopTask(void*) at ../esp-idf/test/components/arduino/cores/esp32/main.cpp:42
0x40095d35: vPortTaskWrapper at ../esp/v4.4.6/esp-idf/components/freertos/port/xtensa/port.c:142

And the error is caused on this line:

epd_init(&epd_board_v5, &ED133UT2, EPD_LUT_64K);

It basically fails on the first initialisation of epdiy.

Additional Details:

martinberlin commented 1 month ago

That’s really strange in v7 works. Actually it is only on deinitialization. Are you sure nothing at all is changed in your side of the things? Wanted to reproduce it but I gave out all my v5 boards