esp32_arduino_sqlite3_lib icon indicating copy to clipboard operation
esp32_arduino_sqlite3_lib copied to clipboard

esp32 SPIRAM replacement for malloc

Open majorninth opened this issue 3 years ago • 1 comments

Is there an existing override in the library to use the external spiram of the esp32 for the heap? if not, is it possible for you to create a new one with the following:

#include "esp_heap_caps.h" #define SQLITE_MALLOC(x) heap_caps_malloc(x, MALLOC_CAP_SPIRAM) //modified was malloc #define SQLITE_FREE(x) heap_caps_free(x) //modified was free #define SQLITE_REALLOC(x,y) heap_caps_realloc((x),(y),MALLOC_CAP_SPIRAM) //modified was realloc

majorninth avatar May 24 '21 01:05 majorninth

Hi, thank you for the suggestion. The question of allocating from PSRAM came up before this, but there does not seem to be a transparent way of doing this. There seems to be a config setting CONFIG_SPIRAM_USE=SPIRAM_USE_MALLOC here: https://arduinojson.org/v6/how-to/use-external-ram-on-esp32/ but I am still trying to figure out how it can be integrated with the Arduino library. I will work on this and try to integrate it.

siara-cc avatar May 29 '21 06:05 siara-cc