[Rprotobuf-yada] finalizer for messages
Romain François
francoisromain at free.fr
Wed Dec 16 12:49:41 CET 2009
Now that I know how to work with external pointer finalizers (much
easier than I anticipated; all covered in R-exts), I have added a
finalizer for Message. We don't need to define them for **Descriptor
because they don't belong to us, but we need to define them for messages
to avoid memory leaks.
So I have added them, now the package does not pass R CMD check. I think
I need to be more careful when I access message fields of other
messages, at the moment, I wrap up the pointer, where I think I should
make a copy of the message.
much more dbugging "fun" to come :( but should be manageaable:
$ grep "Get.*Message" *.cpp
extractors.cpp:
new_RS4_Message_( &ref->GetRepeatedMessage( *message, fieldDesc, i ) ) ) ;
extractors.cpp: res = PROTECT( new_RS4_Message_(
&ref->GetMessage( *message, fieldDesc ) ) ) ;
extractors.cpp: * Get the message descriptor of a Message
identical.cpp:
const GPB::Message* mm1 = &ref->GetRepeatedMessage( *m1, field_desc, j ) ;
identical.cpp:
const GPB::Message* mm2 = &ref->GetRepeatedMessage( *m2, field_desc, j ) ;
identical.cpp: const
GPB::Message* mm1 = &ref->GetMessage( *m1, field_desc ) ;
identical.cpp: const
GPB::Message* mm2 = &ref->GetMessage( *m2, field_desc ) ;
read.cpp: throwException( "could not call
factory->GetPrototype(desc)->New()", "MessageCreationException" ) ;
read.cpp: throwException( "could not call
factory->GetPrototype(desc)->New()", "MessageCreationException" ) ;
read.cpp: throwException( "could not call
factory->GetPrototype(desc)->New()", "MessageCreationException" ) ;
rprotobuf.cpp: throwException( "could not call
factory->GetPrototype(desc)->New()", "MessageCreationException" ) ;
set.cpp:
new_RS4_Message_( &ref->GetRepeatedMessage( *message, field_desc, i ) ) ) ;
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/HlX9 : new package : bibtex
|- http://tr.im/Gq7i : ohloh
`- http://tr.im/FtUu : new package : highlight
More information about the Rprotobuf-yada
mailing list