Hi,
It is probably listed somewhere but I can't find it for now: is there a limit on the length of a string you can ask for or provide via the cJSON implementation in ESP-IDF?
I am writing our own parameter storage interface layer which uses NVS to store various parameters in flash and I am wondering if the cJSON implementation can handle the maximum string parameter length of 1984 as defined by the NVS component?
Any help much appreciated.
cJSON value string limit?
Re: cJSON value string limit?
In case you don't get an answer here, you might want to search and/or post the question to the cJSON project here:
https://github.com/DaveGamble/cJSON
https://github.com/DaveGamble/cJSON
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: cJSON value string limit?
Hi Zingemneire,
I'm not a cJSON expert, but I do know that internally a string is stored by cJSON as a "const char *", and that they use standard C functions like strlen() to find the length.
So I would expect that the string length limit is the maximum value of size_t minus 1, ie 2^32 - 2. So several orders of magnitude more than the NVS length limit (or the available addressable memory in an ESP32!)
As I said, there may be some secondary limiting factor I'm not aware of. But I expect not.
I'm not a cJSON expert, but I do know that internally a string is stored by cJSON as a "const char *", and that they use standard C functions like strlen() to find the length.
So I would expect that the string length limit is the maximum value of size_t minus 1, ie 2^32 - 2. So several orders of magnitude more than the NVS length limit (or the available addressable memory in an ESP32!)
As I said, there may be some secondary limiting factor I'm not aware of. But I expect not.
-
- Posts: 68
- Joined: Tue Apr 17, 2018 7:35 am
Re: cJSON value string limit?
Hi Guys,
I got confirmation from GitHub/cJSON. There is no limit except for physical memory limits.
I got confirmation from GitHub/cJSON. There is no limit except for physical memory limits.
Who is online
Users browsing this forum: ulaoulao and 115 guests