From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jonas Hahnfeld via "Developers list for Guile, the GNU extensibility library" Newsgroups: gmane.lisp.guile.devel Subject: Re: GC + Java finalization Date: Fri, 19 Nov 2021 14:40:16 +0100 Message-ID: <21fe294b75b001afbd1be0e972a19ddb7187e98b.camel@hahnjo.de> References: <9ce77d5e08d50456eddc575179b68ac17afc9bf6.camel@hahnjo.de> <1cc3648e5196bf23023ec7a0ab95a9ad46f8554c.camel@telenet.be> Reply-To: Jonas Hahnfeld Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-BE/iRiMw6CuLxGWWOaF0" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23552"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.42.1 To: Maxime Devos , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Fri Nov 19 14:40:53 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 1mo48K-0005wO-Qo for guile-devel@m.gmane-mx.org; Fri, 19 Nov 2021 14:40:52 +0100 Original-Received: from localhost ([::1]:36364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo48J-0001Xp-PR for guile-devel@m.gmane-mx.org; Fri, 19 Nov 2021 08:40:51 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:57460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo47o-0001WU-Vr for guile-devel@gnu.org; Fri, 19 Nov 2021 08:40:22 -0500 Original-Received: from [2a03:4000:2a:2c1::1] (port=51178 helo=mail.hahnjo.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo47n-0001OX-CR for guile-devel@gnu.org; Fri, 19 Nov 2021 08:40:20 -0500 Original-Received: from [IPv6:2001:16b8:1e92:200:6657:51b0:48f8:9366] (unknown [IPv6:2001:16b8:1e92:200:6657:51b0:48f8:9366]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.hahnjo.de (Postfix) with ESMTPSA id 427A254289E5; Fri, 19 Nov 2021 14:40:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hahnjo.de; s=default; t=1637329217; bh=BQ3aY4M7RgLhmnDvGc8qASSPC4ctGqF/fcfUSc9qVYo=; h=Subject:From:To:Date:In-Reply-To:References; b=VqKsDpGScRLD69tIBXVZd4ar59446Rg5K0ROYQwZ4+ZykXq7tNpFhmVQUDfATjiaw /o74GQTerJ55im80eaR37IEryl/YF2BgIw3eTO7uHenOGEQCcm1gxsSzUdxXEGnUEx 90WFjg8ryJvokWSZP+zh2r4LOb6xVfCB10vq9nlU97hAnZWiENm+85lZWwnJku+igH FnbvTtSDIZoChv6IiQhJJfJSyT/5AFUWcpwKG9LAM9Ys6zF3U6/sRWuG/5E1leZMLG 3Du1UZ7raYuRGBk9wLyRaY+ssJPiloLnHu2pOBl73zAH/koswsL4X2vhZV/M3iIgD2 zHpHBuGkTmntw== In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a03:4000:2a:2c1::1 (failed) Received-SPF: pass client-ip=2a03:4000:2a:2c1::1; envelope-from=hahnjo@hahnjo.de; helo=mail.hahnjo.de X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, 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:20961 Archived-At: --=-BE/iRiMw6CuLxGWWOaF0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Am Freitag, dem 19.11.2021 um 13:35 +0000 schrieb Maxime Devos: > Jonas Hahnfeld schreef op vr 19-11-2021 om 14:32 [+0100]: > > > You coud simply ... > > >=20 > > >=20 > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 scm_gc_free (rx, sizeof(regex_t), "= regex"); > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 free (rx); > > >=20 > > > drop the scm_gc_free AFAIK. > >=20 > > No, I cannot as explained in the patch summary: If we use > > scm_gc_free > > in a free function of a Smob, this relies on Java finalization > > because > > the memory must not be reclaimed in the same cycle. >=20 > The suggestion was to remove scm_gc_free, and not introduce free. > I.e., don't free rx manually at all, let boehmgc decide: >=20 > =C2=A0regex_free (SCM obj) > =C2=A0{ > =C2=A0=C2=A0 regfree (SCM_RGX (obj)); > -=C2=A0 scm_gc_free (SCM_RGX (obj), sizeof(regex_t), "regex"); > =C2=A0 =C2=A0return 0; > =C2=A0} This is dangerous because we still pass the memory to regfree, so it must not be freed before. --=-BE/iRiMw6CuLxGWWOaF0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEXw/5YGpL6H9VOgO2kcnDPSxhrNsFAmGXqUAACgkQkcnDPSxh rNuc/Qf/VPmBVqsrnkoX0sGiR/+CcBVs4/RmhwqoBU4kuDl0fBa745RM7lFlQlSs S3wIGp1IpVeF2Vf2L0Hlq8t93iaYyMAPFRfPUc7N7KzudHpO6ECty4ym6SruCTMy rc39pzX1bhLbAOSdBTcnHRAkOTTpo9ot/WoO4FuEKuOKXDYPBgcbsp6+pazpZ5V8 /0D0CjxjIkYxt4S3wf37IYeBn3mLJiKkF7PMp45j+f00m7jdC3oQBLJaR4LRgnVq 1JGqmTTH6ipz8p5MA8l7FBcpRWEe+vAqkAR5lDV0yetv9bR3SqnSn0CGnxTv4GZ0 pRM1D1PF7b/BWsyKo1pyaOMSvqb1Lg== =OqR1 -----END PGP SIGNATURE----- --=-BE/iRiMw6CuLxGWWOaF0--