From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxime Devos Newsgroups: gmane.lisp.guile.devel Subject: Re: GC + Java finalization Date: Fri, 19 Nov 2021 14:01:58 +0000 Message-ID: References: <9ce77d5e08d50456eddc575179b68ac17afc9bf6.camel@hahnjo.de> <1cc3648e5196bf23023ec7a0ab95a9ad46f8554c.camel@telenet.be> <21fe294b75b001afbd1be0e972a19ddb7187e98b.camel@hahnjo.de> <43a9f555dec7ddeee1ad34c278042a6bad6c59ec.camel@telenet.be> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28175"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.38.3-1 To: Jonas Hahnfeld , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Fri Nov 19 15:11:14 2021 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mo4bh-00077k-1c for guile-devel@m.gmane-mx.org; Fri, 19 Nov 2021 15:11:13 +0100 Original-Received: from localhost ([::1]:44430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo4bf-0004DW-Lt for guile-devel@m.gmane-mx.org; Fri, 19 Nov 2021 09:11:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo4T2-0005dW-1H for guile-devel@gnu.org; Fri, 19 Nov 2021 09:02:17 -0500 Original-Received: from [2a02:1800:120:4::f00:15] (port=45680 helo=andre.telenet-ops.be) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mo4Sn-0002gX-QK for guile-devel@gnu.org; Fri, 19 Nov 2021 09:02:07 -0500 Original-Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by andre.telenet-ops.be with bizsmtp id LE1y2600K4UW6Th01E1yPs; Fri, 19 Nov 2021 15:01:59 +0100 In-Reply-To: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1637330519; bh=/E0S0aP6xs+A+sM4Y75lkBEInppuuagtMgjaGVTBO+o=; h=Subject:From:To:Date:In-Reply-To:References; b=jahvP6Y/LitFhXwfc7vrDcVYo5qj6mX1XRr7UPGry22K1Rv1txcszPAdjcpMO0AOs uOH1nKFJ7OE3A+c/u1yI1PfXD7QJ2/Bx0i0vMiQQpdWLr/67nB8HWyotaxtp0UqyD9 kZ23q3z47720x9PvybRZrRBiYDRI6l9NN08CvMO5ad+MTJLYy8rsmMjuHBSmNvHv8o ntlNweCTUvHZUC0DzCbGqbDTxmQd3GtpL+z6y4e2v5jcm6/R6Y+boqG976G9kKGD5I DuK54PbbmRobYFL2nne3Mabqg/gu/Me4aPt7jrnjW60vh8aN4z1enSSWn+kNIYmtEV U3ICP8rUJqbJw== X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a02:1800:120:4::f00:15 (failed) Received-SPF: pass client-ip=2a02:1800:120:4::f00:15; envelope-from=maximedevos@telenet.be; helo=andre.telenet-ops.be X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20968 Archived-At: Jonas Hahnfeld schreef op vr 19-11-2021 om 14:53 [+0100]: > [...] > The straight-forward solution is to statically tie the lifetime of > regex_t to that of the smob. Which we cannot do with GC, but simply > with malloc+free - as implemented in the patch. OK, but for clarity I recommend adding a comment like /* When not using Java-style finalisation, we must make sure the memory for the regex_t is only freed after regfree. To do so, use scm_malloc+free instead of scm_gc_free such that boehmgc will only free the regex_t when we ask it to in regex_free, and it won't automatically free the regex_t too early. */ Otherwise, it would be easy to think ‘Hmm, this code would be simpler if we just use scm_gc_malloc and remove the unnecessary free’ and accidentally introduce a bug ... Greetings, Maxime