That does seem surprising; something must be going wrong if the number of mallocs is going up when you use arenas. Could you post your .proto file and test code here?
One thing to keep in mind is that string and bytes fields almost always require a heap allocation, because std::string stores its data on the heap, except when the string is short enough that it can be stored directly in the std::string layout (the short string optimization). That might explain why some heap allocations remain even when you use arenas, though it doesn't explain why the number of allocations went up. On Thu, Sep 7, 2017 at 11:53 PM, Srihita Goli <[email protected]> wrote: > I have a proto that has one nested message (3 integer fields, 1 bool and 1 > bytes field) that is repeated, a few integer fields( around 10) and a > couple of bools. The serialized size of the this proto is around 35 bytes > and the deserialized size around 350 bytes. I tried to deserialize this > proto using ParseFromString and use malloc counters to find the number of > mallocs for this call. When I do not use arena for the underlying message > for the deserialized entry, I see around 5 mallocs for any number of > successive deserializations. But, when I use arena(with sufficient > preallocated size so that it doesn't require any more blocks allocs) for > the underlying message, I see that number of mallocs becomes variable and > the average number of mallocs went up to 16. Is this an expected behavior? > I wanted to know what could be a possible reason for this. > > > -- > 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 post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
