Fixed memory leak of Ruby arena objects. (#8465)

In our free() method, we were freeing the memory from the
upb arena but we were failing to free the memory for the
Ruby arena object. This was causing every Ruby arena object
to leak: even though the objects were getting GC'd, the
underlying memory was not getting released.

Co-authored-by: Joshua Haberman <jhaberman@gmail.com>
pull/8555/head
Adam Cozzette 4 years ago committed by GitHub
parent 7689f00ba8
commit e8b78f8208
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      ruby/ext/google/protobuf_c/protobuf.c

@ -180,6 +180,7 @@ static void Arena_mark(void *data) {
static void Arena_free(void *data) { static void Arena_free(void *data) {
Arena *arena = data; Arena *arena = data;
upb_arena_free(arena->arena); upb_arena_free(arena->arena);
xfree(arena);
} }
static VALUE cArena; static VALUE cArena;

Loading…
Cancel
Save