Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: automatically use psram if available? #22

Open
elklaaso opened this issue Dec 8, 2023 · 2 comments
Open

feature: automatically use psram if available? #22

elklaaso opened this issue Dec 8, 2023 · 2 comments

Comments

@elklaaso
Copy link

elklaaso commented Dec 8, 2023

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?

@siara-cc
Copy link
Owner

@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.

@elklaaso
Copy link
Author

great, also did not notice any significant performance degradation on psram btw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants