A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://arduinojson.org/v6/api/jsondocument/memoryusage/ below:

JsonDocument::memoryUsage() | ArduinoJson 6

Description

JsonDocument::memoryUsage() the number of bytes used in the JsonDocument.

Unlike JsonArray::memoryUsage(), JsonObject::memoryUsage(), and JsonVariant::memoryUsage(), the result includes leaked memory.

Use this function at design time to measure the required capacity for the JsonDocument.

Signature
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
  1. Home
  2. Version 6
  3. API
  4. JsonDocument
  5. memoryUsage()

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