Skip to content

Commit

Permalink
Fixed memory leak of Ruby arena objects. (#8465)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
acozzette and haberman authored Apr 7, 2021
1 parent 7689f00 commit e8b78f8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ruby/ext/google/protobuf_c/protobuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ static void Arena_mark(void *data) {
static void Arena_free(void *data) {
Arena *arena = data;
upb_arena_free(arena->arena);
xfree(arena);
}

static VALUE cArena;
Expand Down

0 comments on commit e8b78f8

Please sign in to comment.