Hello. I'm trying to use arena in protobuf with C++ but keep getting weird 
assertion fail. I create std::array<char, 1024> on the stack and pass it to 
the arena as the initial block like this:
google::protobuf::Arena m_arena{arenaBuf.data(), arenaBuf.size()}.

During arena construction i get "CHECK failed: 
(reinterpret_cast<uintptr_t>(mem) & 7) == (0u)". Could you please help me 
to figure out what does it mean? What should i do to fix it?

P.s. it's very weird because only in 1 test file this assert fails. I do 
the same everywhere in the project, but only 1 test doesn't want to run and 
fails with this assert.

Also, we got some old protobuf code. Not one that in github master. The 
function with weird assert is this:

void ThreadSafeArena::InitializeFrom(void* mem, size_t size)
{ 
GOOGLE_DCHECK_EQ(reinterpret_cast<uintptr_t>(mem) & 7, 0u); 
GOOGLE_DCHECK(!AllocPolicy()); 
// Reset should call InitializeWithPolicy instead. Init(); 
// Ignore initial block if it is too small. 
if (mem != nullptr && size >= kBlockHeaderSize + kSerialArenaSize) 
{ 
alloc_policy_.set_is_user_owned_initial_block(true); SetInitialBlock(mem, 
size); 
} 
} 

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/protobuf/343c244e-55f5-4c24-ad9d-5951179a2640n%40googlegroups.com.

Reply via email to