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-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=unavailable autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 8BC441F5AE for ; Wed, 15 Jul 2020 23:35:56 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 20B81120A39; Thu, 16 Jul 2020 08:35:25 +0900 (JST) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by neon.ruby-lang.org (Postfix) with ESMTPS id 151AD1209E2 for ; Thu, 16 Jul 2020 08:35:21 +0900 (JST) Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 7DB621F5AE; Wed, 15 Jul 2020 23:35:40 +0000 (UTC) Date: Wed, 15 Jul 2020 23:35:40 +0000 From: Eric Wong To: ruby-core@ruby-lang.org Message-ID: <20200715233540.GA14457@dcvr> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-ML-Name: ruby-core X-Mail-Count: 99185 Cc: unicorn-public@yhbt.net Subject: [ruby-core:99185] Re: [Ruby master Bug#17023] How to prevent String memory to be relocated in ruby-ffi X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" tenderlove@ruby-lang.org wrote: > Right, that makes sense. I really need to document this (and > I apologize for not doing so already), but > `rb_gc_register_address` will pin your objects. When you know > you're done with the reference, you can release it with > `rb_gc_unregister_address`. Of course if you don't call the > unregister function, the reference will stay alive forever. Btw, does rb_gc_register_mark_object pin? A quick glance at gc.c tells me it doesn't, and I'll need to revert commit 2a6cb76d5010cb763ef5a2c305728465d15eb7c9 in unicorn: https://yhbt.net/unicorn-public/20181226050857.6413-1-e@80x24.org/ Anyways, it takes me too long to compile Ruby so I'm back to running whatever my distro ships. I haven't been able to test GC.compact at all. > https://bugs.ruby-lang.org/issues/17023#change-86563