Skip to content

Commit

Permalink
Merge pull request #6073 from tenderlove/compaction-friendly
Browse files Browse the repository at this point in the history
Register mark objects so Protobuf is compaction friendly
  • Loading branch information
haberman authored Mar 11, 2021
2 parents 43aca57 + addd061 commit 80fe990
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ruby/ext/google/protobuf_c/protobuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "message.h"
#include "repeated_field.h"

VALUE cError;
VALUE cParseError;
VALUE cTypeError;

const upb_fielddef* map_field_key(const upb_fielddef* field) {
Expand Down Expand Up @@ -368,8 +368,10 @@ void Init_protobuf_c() {
Map_register(protobuf);
Message_register(protobuf);

cError = rb_const_get(protobuf, rb_intern("Error"));
cParseError = rb_const_get(protobuf, rb_intern("ParseError"));
rb_gc_register_mark_object(cParseError);
cTypeError = rb_const_get(protobuf, rb_intern("TypeError"));
rb_gc_register_mark_object(cTypeError);

rb_define_singleton_method(protobuf, "discard_unknown",
Google_Protobuf_discard_unknown, 1);
Expand Down

0 comments on commit 80fe990

Please sign in to comment.