esp32-idf-sqlite3
esp32-idf-sqlite3 copied to clipboard
feature: automatically use psram if available?
by changing this in sqlite.c:
#define SQLITE_MALLOC(x) malloc(x) #define SQLITE_FREE(x) free(x) #define SQLITE_REALLOC(x,y) realloc((x),(y))
to:
#ifdef BOARD_HAS_PSRAM #define SQLITE_MALLOC(x) ps_malloc(x) #define SQLITE_FREE(x) free(x) #define SQLITE_REALLOC(x,y) ps_realloc((x),(y)) #else #define SQLITE_MALLOC(x) malloc(x) #define SQLITE_FREE(x) free(x) #define SQLITE_REALLOC(x,y) realloc((x),(y)) #endif
psram can then be enabled with this build flag: -DBOARD_HAS_PSRAM
or is it the goal to leave sqlite.c unedited?
@elklaaso Hi thanks for sharing this. Yes this looks like a good idea. sqlite.c already has some changes from the original so it is alright to do this although it may be a good idea to minimize changing it.
great, also did not notice any significant performance degradation on psram btw.