cJSON_Delete() freeing nodes in reverse order of allocation
Brought to you by:
davegamble
I've added a preprocessor switch to cJSON_Delete() to change the order of how the nodes of a cJSON object are freed.
I use a memory management implementation which is utterly slow if there are a lot of allocated memory chunks and the chunks are not freed in reverse order of allocation (last allocated first freed).
For large JSON objects with a lot of child objects I could shorten the execution time of cJSON_Delete() by factor 250.
I believe for "default" memory managements this optimization is counterproductive - nevertheless I wanted to share it.
cJSON_Delete() with preprocessor switch.