mirror of
https://github.com/nlohmann/json.git
synced 2026-10-27 19:15:24 +00:00
deploy: 21ec9bd801
This commit is contained in:
@@ -23,6 +23,10 @@ Linear in [`node_count()`](node_count.md) plus the length of the decoded strings
|
||||
|
||||
## Notes
|
||||
|
||||
The node index of a small document (an estimate of up to 1024 nodes, which is up to about 4 KiB of minified text) is
|
||||
allocated together with the document's header, so that parsing needs one allocation. That part cannot be released
|
||||
separately: `shrink_to_fit()` only trims a node index that has its own allocation, and the decoded strings.
|
||||
|
||||
!!! warning "Invalidates views"
|
||||
|
||||
Unlike moving the document, `shrink_to_fit()` **invalidates every view taken from this document before the
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -20,6 +20,8 @@ Linear in [`node_count()`](https://json.nlohmann.me/api/basic_json_document/node
|
||||
|
||||
## Notes
|
||||
|
||||
The node index of a small document (an estimate of up to 1024 nodes, which is up to about 4 KiB of minified text) is allocated together with the document's header, so that parsing needs one allocation. That part cannot be released separately: `shrink_to_fit()` only trims a node index that has its own allocation, and the decoded strings.
|
||||
|
||||
Invalidates views
|
||||
|
||||
Unlike moving the document, `shrink_to_fit()` **invalidates every view taken from this document before the call**, including a previously obtained [`root()`](https://json.nlohmann.me/api/basic_json_document/root/index.md): the node index is moved into a new, smaller allocation, and the old one is freed. Take a fresh view from [`root()`](https://json.nlohmann.me/api/basic_json_document/root/index.md) after calling this function.
|
||||
|
||||
File diff suppressed because one or more lines are too long
+403
-403
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Reference in New Issue
Block a user