Loading…
|
Translation uploaded |
|
|
String added in the repository |
|
Flags
safe-html, strict-same
Loading…
|
Translation uploaded |
|
|
String added in the repository |
|
Consider the pattern of memory allocation during parsing: when an array, object, or string is encountered the parser accumulates elements in its temporary storage area. When all of the elements are known, a single memory allocation is requested from the resource when constructing the value. Thus, parsing only allocates and constructs containers at their final size. Memory is not reallocated; that is, a memory buffer never needs to grow by allocating a new larger buffer and deallocating the previous buffer.考虑解析过程中的内存分配模式:当遇到数组、对象或字符串时,解析器会将其元素累积在临时存储区中。当所有元素都已知后,在构造值时会向内存资源发起一次内存分配请求。因此,解析过程仅在容器最终大小确定时进行一次分配和构造,不会发生内存重分配;也就是说,内存缓冲区无需通过分配更大的新缓冲区并释放旧缓冲区的方式来扩容。