From 67fee915e01a35d86e73634441af256f386f60b0 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 7 Apr 2021 10:30:51 -0700 Subject: [PATCH] Fixed memory leak of Ruby arena objects. 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. --- ruby/ext/google/protobuf_c/protobuf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ruby/ext/google/protobuf_c/protobuf.c b/ruby/ext/google/protobuf_c/protobuf.c index 65263a44c..490cda670 100644 --- a/ruby/ext/google/protobuf_c/protobuf.c +++ b/ruby/ext/google/protobuf_c/protobuf.c @@ -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;