Fix block overhead estimation in tests
Summary: folly/test/ArenaTest.h assumes that goodMallocSize will account for the block overhead, if the size is +1. However, when compiling without jemalloc (as, I would imagine, most of our open-source clients do), goodMallocSize(64 + 1) returns 65, which is less than 64 + sizeof(Block), and so the tests fail. I have added a constant to Arena.h which exposes the overhead taken by the Block, and changed the tests to use that value instead of 1. (Arena::getTotalSize relies on the totalAllocatedSize_ variable, which is only non-trivially set in allocateSlow, where the size of the heap is added to sizeof(Block)). Test Plan: fbconfig --allocator=malloc folly/test:arena_test && fbmake runtests Reviewed By: jon.coens@fb.com Subscribers: sdwilsh, njormrod FB internal diff: D1512231
Showing
Please register or sign in to comment