diff --git a/Memory model.md b/Memory model.md index 4241902..a8d1ff0 100644 --- a/Memory model.md +++ b/Memory model.md @@ -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 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