Basically any object can be created on an arena with google::protobuf::Arena::Create. How is it possible to allocate another object in place of an already allocated one? I tried the following:
class My_stuff{};
int main(){
google::protobuf::Arena arena;
My_stuff* ptr = google::protobuf::Arena::Create<My_stuff>(&arena);
ptr = google::protobuf::Arena::Create<My_stuff>(&arena); /* Does this not duplicate the allocated data? */
return 0;
}
Does that not duplicate data? In case allocating in the place of the object is not possible, how can
an object be deleted from the arena? In case messages it's quite straightorward as the release_message
method can be used.