mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-08-07 22:54:43 +02:00
Updated Memory model (markdown)
@@ -47,6 +47,22 @@ This fixed allocation approach may seem a bit strange, especially if your a desk
|
||||
|
||||
Don't forget that the memory is "freed" as soon as the `StaticJsonBuffer` is out of scope, like any other variable. It only hold the memory for a short amount of time.
|
||||
|
||||
## Dynamic memory allocation
|
||||
|
||||
This library also supports dynamic memory allocation.
|
||||
|
||||
However, usage of this memory model is **strongly discouraged** in embedded environments.
|
||||
|
||||
To switch to dynamic memory allocation, simply replace:
|
||||
|
||||
StaticJsonBuffer<N> jsonBuffer;
|
||||
|
||||
by
|
||||
|
||||
DynamicJsonBuffer jsonBuffer;
|
||||
|
||||
Memory is released in `DynamicJsonBuffer`'s destructor, so you don't have to do anything special.
|
||||
|
||||
## Memory usage
|
||||
|
||||
#### Object size for 8-bit AVR
|
||||
|
Reference in New Issue
Block a user