Skip to content

Commit

Permalink
If max block size is specified, don't add our internal bookkeeping ov…
Browse files Browse the repository at this point in the history
…erhead on top of it.

PiperOrigin-RevId: 713766718
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Jan 9, 2025
1 parent 509b0d0 commit 3580d09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion upb/mem/arena.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ static bool _upb_Arena_AllocBlock(upb_Arena* a, size_t size) {

// We may need to exceed the max block size if the user requested a large
// allocation.
size_t block_size = UPB_MAX(size, clamped_size) + kUpb_MemblockReserve;
size_t block_size = UPB_MAX(kUpb_MemblockReserve + size, clamped_size);

upb_MemBlock* block =
upb_malloc(_upb_ArenaInternal_BlockAlloc(ai), block_size);
Expand Down

0 comments on commit 3580d09

Please sign in to comment.