Updated Memory model (markdown)

bblanchon
2014-12-22 11:54:18 -08:00
parent 843e7a4be8
commit dcd9d7bf46

@@ -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. 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 ## Memory usage
#### Object size for 8-bit AVR #### Object size for 8-bit AVR