On Wed, Nov 25, 2015 at 10:39 AM <[email protected]> wrote:

> Hello,
>
> i'am using a copy of the master branch of protobuf v 3.0.0-beta-1.
>
> {
>    DynamicMessageFactory dynamicMessageFactory;
>    Arena myArena;
>
>    const Descriptor *messageDesc =
> m_pProtoFileDescriptor->FindMessageTypeByName( "Foo" );
>    Message *fooMessage = dynamicMessageFactory.GetPrototype( messageDesc
> )->New(&myArena);
> }
>
> What i try to do is loading a .proto file at runtime and create various
> Message instances from it by name. I want to use a Arena cause of the
> massive amount of message creations out of this loaded .proto Descriptor.
>
> Unfortunately both the DynamicMessageFactory and the Arena try to destroy
> the created message. The Message::New method description says that the
> ownership of the created message will be passed to the caller or in this
> case the arena.
>
This does sound like a bug in DynamicMessageFactory implementation. Could
you help file an bug for this on our github site?


>
> Is there another way to create Message instances out of a Descriptor at
> runtime?
>
No. DynamicMessageFactory is the only way.


> Is it intended to use the DynamicMessageFactory in common with a Arena?
>
Yes. Although as this feature is not used very frequently, there might be
bugs in its implementation.


>
> With best regards,
>
> Torsten
>
> --
> 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 http://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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to