From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id DB92F1F5AE; Tue, 25 May 2021 22:50:37 +0000 (UTC) Date: Tue, 25 May 2021 22:50:37 +0000 From: Eric Wong To: Aaron Patterson , Ngan Pham Cc: kgio-public@yhbt.net Subject: Re: Patch for GC.compact memory issue Message-ID: <20210525225037.GA3369@dcvr> References: <20210524172208.GA7627@dcvr> <20210524203310.GA17864@dcvr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: Thanks all, pushed as 4db359156adb5aed102ec853f56c030ba40b1eca with the commit message below. Will release in a bit.. -----8<----- From: Ngan Pham Date: Mon, 24 May 2021 20:34:36 +0000 Subject: [PATCH] fix compatibility with GC.compact Constants defined in Ruby need to be explicitly marked when made static inside a C extension. Link: https://yhbt.net/kgio-public/CAAvYYt5Z5f2rMuXO5DMpR1-6uRvu_gXKDvqcyoZ+oNcLiTH39g@mail.gmail.com/T/ Commit-message-by: Eric Wong --- ext/kgio/accept.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/kgio/accept.c b/ext/kgio/accept.c index f1de39d..4bd9cfe 100644 --- a/ext/kgio/accept.c +++ b/ext/kgio/accept.c @@ -498,9 +498,12 @@ void init_kgio_accept(void) rb_define_const(mKgio, "SOCK_CLOEXEC", INT2NUM(SOCK_CLOEXEC)); localhost = rb_const_get(mKgio, rb_intern("LOCALHOST")); + rb_gc_register_mark_object(localhost); cKgio_Socket = rb_const_get(mKgio, rb_intern("Socket")); + rb_gc_register_mark_object(cKgio_Socket); cClientSocket = cKgio_Socket; mSocketMethods = rb_const_get(mKgio, rb_intern("SocketMethods")); + rb_gc_register_mark_object(mSocketMethods); rb_define_method(mSocketMethods, "kgio_addr!", addr_bang, 0);