JsonObject::memoryUsage()
returns the number of bytes used by the object pointed by the JsonObject
.
Unlike JsonDocument::memoryUsage()
, the result doesn’t include leaked memory.
size_t memoryUsage() const;
Example
char json[] = "{\"a\":1,\"b\":2}";
StaticJsonDocument<200> doc;
deserializeJson(doc, json);
JsonObject object = doc.as<JsonObject>();
object.remove("b"); // remove last member to show the effect of a leak
Serial.println(object.memoryUsage()); // 10 on AVR
Serial.println(doc.memoryUsage()); // 16 on AVR
See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4