File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1052,7 +1052,15 @@ TEST(MicroStringTest, MemoryUsageComparison) {
1052
1052
int64_t this_micro_str_used = micro_str.SpaceUsedExcludingSelfLong ();
1053
1053
int64_t this_arena_str_used = SpaceUsedExcludingSelfLong (arena_str);
1054
1054
// We expect to always use the same or less memory.
1055
- EXPECT_LE (this_micro_str_used, this_arena_str_used);
1055
+ if (sizeof (void *) >= 8 ) {
1056
+ EXPECT_LE (this_micro_str_used, this_arena_str_used);
1057
+ } else {
1058
+ // Except that in 32-bit platforms we have heap alignment to 4 bytes, but
1059
+ // arena alignment is always 8. Take that fact into account by rounding up
1060
+ // the ArenaStringPtr use.
1061
+ EXPECT_LE (this_micro_str_used,
1062
+ ArenaAlignDefault::Ceil (this_arena_str_used));
1063
+ }
1056
1064
1057
1065
int64_t diff = micro_str_used - arena_str_used;
1058
1066
int64_t this_diff = this_micro_str_used - this_arena_str_used;
You can’t perform that action at this time.
0 commit comments