A RetroSearch Logo

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

Search Query:

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

JsonDocument::capacity() | ArduinoJson 6

Description

JsonDocument::capacity() returns the capacity of the memory pool of the JsonDocument.

Unlike JsonDocument::memoryUsage(), the result of JsonDocument::capacity() doesn’t change during the life of the JsonDocument::memoryUsage().

For StaticJsonDocument, the result is always equal to the capacity set as a template parameter.

For DynamicJsonDocument, the result should be equals to the capacity set in the constructor, but it can be zero if the memory allocation failed.

Use this function to check that the memory allocation succeeded.

Signature Example StaticJsonDocument
StaticJsonDocument<256> doc;
doc.capacity(); // 256
DynamicJsonDocument
DynamicJsonDocument doc(1024);
doc.capacity(); // 1024
Zero when allocation fails
DynamicJsonDocument doc(1000000000);
doc.capacity(); // 0
See also
  1. Home
  2. Version 6
  3. API
  4. JsonDocument
  5. capacity()

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