Repository navigation
Conversation
Uses the provided allocator to allocate the stack used to avoid recursion in the destroy() implementation used by ~basic_json.
|
This pull request has been marked as stale because it has had no activity for 30 days. While we won’t close it automatically, we encourage you to update or comment if it is still relevant. Keeping pull requests active and up-to-date helps us review and merge changes more efficiently. Thank you for your contributions! |
|
Please rebase to the latest |
|
This pull request has been marked as stale because it has had no activity for 30 days. While we won’t close it automatically, we encourage you to update or comment if it is still relevant. Keeping pull requests active and up-to-date helps us review and merge changes more efficiently. Thank you for your contributions! |
|
This pull request has been marked as stale because it has had no activity for 30 days. While we won’t close it automatically, we encourage you to update or comment if it is still relevant. Keeping pull requests active and up-to-date helps us review and merge changes more efficiently. Thank you for your contributions! |
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Adds a regression test for nlohmann#4842: destroying a nested array or object must allocate its temporary stack through the basic_json allocator, not std::allocator. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
|
Thanks a lot for the fix, @veselink1, and sorry this sat for so long. I merged the latest This comment was written by Claude Code on behalf of @nlohmann. |
|
@nlohmann I wonder if any of the other temporary vectors added in the recent iterative cleanups should also use the provided allocator. |
|
@gregmarr Good question, thanks! I went through them. Most of the new temporary vectors hold only pointers, iterators and counters: the copy worklist and the stacks for merging (#5547), hashing (#5546), The one exception is the deep copy's key scratch space from #5389. It holds This comment was written by Claude Code on behalf of @nlohmann. |
|
@veselink1 Are you willing to complete this? |
|
Thanks a lot for this fix, @veselink1! Since we didn't hear back, we continued in #5762. Your commit is included there with you as author. With the allocator in place, a failing allocator could make the destructor throw (#5135), so #5762 goes one step further and makes destruction completely allocation-free. This comment was written by Claude Code on behalf of @nlohmann. |
Uses the provided allocator to allocate the stack used to avoid recursion in the destroy() implementation used by ~basic_json.
This addresses issue #4842, by changing the std::vector to use the user-provided allocatorl