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: Sat, 03 Jul 2021 19:14:45 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-5CWJ9/mHm595ZKWCX2iA" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5058"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.34.2 To: Jonas Hahnfeld , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Sat Jul 03 19:15:35 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 1lzjEt-0001A5-Of for guile-devel@m.gmane-mx.org; Sat, 03 Jul 2021 19:15:35 +0200 Original-Received: from localhost ([::1]:40180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lzjEs-0008Ol-8l for guile-devel@m.gmane-mx.org; Sat, 03 Jul 2021 13:15:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lzjEI-0008OZ-SB for guile-devel@gnu.org; Sat, 03 Jul 2021 13:14:58 -0400 Original-Received: from xavier.telenet-ops.be ([2a02:1800:120:4::f00:14]:44482) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lzjEG-0004HB-E2 for guile-devel@gnu.org; Sat, 03 Jul 2021 13:14:58 -0400 Original-Received: from butterfly.local ([188.189.167.54]) by xavier.telenet-ops.be with bizsmtp id QhEr2500L1AlBsU01hEsop; Sat, 03 Jul 2021 19:14:53 +0200 In-Reply-To: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1625332493; bh=Z/jglD37IVYYXb101CiJa2Y6y5db4OuofxlgIa2CZG0=; h=Subject:From:To:Date:In-Reply-To:References; b=blIDNA0rjlyVmFFPRfHNEJtIs8kwYUa5dgZ6D4hoMy/W54Ao4oJLd9I6jIJBS3C2d 7ThQo2X/xOUfmn62Ua0ChuYuL732GmOW9fK1H2MhOZ7WEjGQJ1gW60HX8/vfbv82y3 vOxJbc7jSviVxRu7ZeI6/zMOa17LKwwBDOjU6B8udH6IHFfyR0m8G+MX5YI+x3j5Tl ez+qO+IdsxtIGlMnh4EJ3o9HE0ijM89v93r69f9ooiH15Xcn5aH1MuAQUxqH44otcY 5/WXcKDc/hvH2itQ9yP/Xon40s+02xdCyBR2pp/YENPVMY+JyEjIkxuZnE6ddOGdsJ diuDh4xvB/7+A== Received-SPF: pass client-ip=2a02:1800:120:4::f00:14; envelope-from=maximedevos@telenet.be; helo=xavier.telenet-ops.be X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 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:20796 Archived-At: --=-5CWJ9/mHm595ZKWCX2iA Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Jonas Hahnfeld via Developers list for Guile, the GNU extensibility library= schreef op za 03-07-2021 om 14:05 [+0200]: > Hi Guile devs, >=20 Hi, I'm not really a Guile dev but I'll respond anyway. > I'm hacking on GNU LilyPond and recently wondered if Guile could run > without Java finalization that prevents collection of chains of > unreachable objects. Do you have an example where this is a problem? I.e., did you encounter =E2=80=98chains of unreachable objects=E2=80=99 tha= t were uncollectable, and so, where? > I found that the functionality is only needed once > the first guardian is created, so it's possible to delay enabling the > mode until then. This required some fixes to free functions that > assumed dependent objects to be freed only later (see first two > patches). > The third patch delays ensuring Java finalization to scm_make_guardian, > but doesn't disable it explicitly (it's on by default in bdwgc). This > could now be done right after GC_INIT(), but it's not clear (at least > to me) whether client applications actually rely it, so I think it's > better if that's not done in Guile itself. >=20 > Please consider applying, the fixes potentially also to stable-2.2. >=20 > Thanks > Jonas I would need to look more closely at how =E2=80=98Java-style=E2=80=99 final= isation works. Some comments anyway: (first patch) > * test-suite/standalone/test-smob-mark.c > (init_smob_type): Correct size of smob type. > (free_x): Clear smob data instead of local variable. > (test_scm_smob_mark): Put smobs in array to ensure marking. > > - fprintf (stderr, "FAIL: SMOB mark function called for each SMOB\n"= ); > + // Print pointer so it cannot be collected before. > + fprintf (stderr, "FAIL: SMOB mark function called for each SMOB (s= mobs =3D %p)\n", smobs); > exit (EXIT_FAILURE); Normally scm_remember_upto_here is used for that. Also, I believe "/* */"-style comments are used customarily used in Guile instead of "//"-style comments. > static void > init_smob_type () > { > - x_tag =3D scm_make_smob_type ("x", sizeof (x_t)); > + x_tag =3D scm_make_smob_type ("x", sizeof (x_t *)); This change seems to be a fix independent of the =E2=80=98do we want Java-s= tyle finalization=E2=80=99 question. (third patch) Note that guardians are used in (ice-9 popen). They are also used by some guile libraries (e.g. guile-fibers), so you can't use (ice-9 popen) or any library using guardians if Java-style finalization is undesirable. Greetings, Maxime. --=-5CWJ9/mHm595ZKWCX2iA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYOCbBRccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7ip3AP99costBYFuVp4GpYelhtbzv4b5 ZKLSxOJosE3TjODPIgD/b7DzhYr54riEWgB27kYNQ22SBUNOTgbpl8uA+AiNwQQ= =suvv -----END PGP SIGNATURE----- --=-5CWJ9/mHm595ZKWCX2iA--