Hello everyone,
How can I force all malloc() calls in cJSON.c to use the external SPI RAM ?
I tried to reduce "CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL" to minimum in menuconfig, but I'm building a big JSON object composed by a lot of small objects and I suspect the result is stored mainly in internal RAM..
If I reduce CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL to 0, some parts like OTA functions doesn't work anymore.
I would like to force all functions of cJSON.c like CreateObject(); cJSON_CreateArray(); cJSON_CreateNumber(); ...etc... to use ONLY external SPI RAM.
Thank you in advance !!
How to use external RAM in cJSON.C calls
-
- Posts: 9724
- Joined: Thu Nov 26, 2015 4:08 am
Re: How to use external RAM in cJSON.C calls
I think you're able to tell cJSON which allocators to use:
my_malloc should then be a function that explicitly returns a block allocated in SPI RAM.
Code: Select all
cJSON_Hooks memoryHook;
memoryHook.malloc_fn = my_malloc;
memoryHook.free_fn = free;
cJSON_InitHooks(&memoryHook);
Who is online
Users browsing this forum: No registered users and 98 guests