You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During ~basic_json, json_value::destroy() allocated a std::vector to
iteratively flatten nested containers. If the allocator threw (e.g.
quota violation), the exception propagated through the noexcept
destructor boundary, calling std::terminate.
Replace with a three-tier strategy. For arrays, children are first
promoted into the parent array's spare vector capacity, no heap
allocation since the move constructor is noexcept and we stay within
capacity. Children that exceed the spare slots overflow to a lazily-
allocated std::vector, which is drained iteratively to preserve O(1)
call-stack depth. For objects, structured values are moved to the
same overflow stack. A try-catch around both tiers ensures that if
the overflow stack cannot be allocated, remaining elements are
destroyed via RAII recursion instead of calling std::terminate. The
overflow stack uses the default allocator to avoid interference from
user allocators that may throw or not forward move semantics.
Signed-off-by: Gareth Lloyd <gareth.lloyd@memgraph.io>
0 commit comments