From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.user Subject: Re: Need for scm_remember_upto_here_* in guile-2.0 Date: Tue, 22 Sep 2015 23:13:45 +0200 Message-ID: <87h9mmjgxi.fsf@gnu.org> References: <20150912132725.5a5e539c@bother.homenet> <87d1xamrmz.fsf@gnu.org> <87fv26bhlw.fsf@fencepost.gnu.org> <878u7yfmmw.fsf@netris.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1442956446 19197 80.91.229.3 (22 Sep 2015 21:14:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Sep 2015 21:14:06 +0000 (UTC) Cc: guile-user@gnu.org, David Kastrup To: Mark H Weaver Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Sep 22 23:14:01 2015 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZeUsy-00017c-6Z for guile-user@m.gmane.org; Tue, 22 Sep 2015 23:14:00 +0200 Original-Received: from localhost ([::1]:42995 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeUsx-0006KF-IY for guile-user@m.gmane.org; Tue, 22 Sep 2015 17:13:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeUso-0006K1-9p for guile-user@gnu.org; Tue, 22 Sep 2015 17:13:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeUsn-0001oi-9H for guile-user@gnu.org; Tue, 22 Sep 2015 17:13:50 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:42549) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeUsn-0001oe-6P; Tue, 22 Sep 2015 17:13:49 -0400 Original-Received: from reverse-83.fdn.fr ([80.67.176.83]:43014 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ZeUsm-0002QW-8t; Tue, 22 Sep 2015 17:13:48 -0400 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 1 =?utf-8?Q?Vend=C3=A9miaire?= an 224 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x3D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu In-Reply-To: <878u7yfmmw.fsf@netris.org> (Mark H. Weaver's message of "Tue, 22 Sep 2015 12:24:07 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.10 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:12028 Archived-At: Mark H Weaver skribis: > David Kastrup writes: > >> ludo@gnu.org (Ludovic Court=C3=A8s) writes: >> >>> In practice scm_remember_upto_here_* is useless with libgc, since libgc >>> also tracks pointers in registers. >> >> Sounds like a big non-sequitur. scm_remember_upto_here_* is for keeping >> SCM values active (including in registers). Any conversion of an SCM >> value to some other data depending on it will not protect the SCM value >> as such and may lead to collection/finalization of the SCM cell (calling >> guardians, removing from weak hashtables and so on). > > I think David is right. Consider the following case: a SMOB contains a > pointer to a block allocated by 'malloc' and freed by the SMOB freeing > procedure. Some C code starts with a SCM value for that SMOB, uses it > to obtain a pointer to the malloc'd block, and then discards the SCM > value and proceeds to do a long-running job on the malloc'd block. If > there are no other references to the SCM value, Boehm GC can free the > SMOB and call its finalizer, which frees the malloc'd block. The > long-running job in C continues to access the freed block. Indeed, that=E2=80=99s a valid scenario. My =E2=80=9Cin practice=E2=80=9D assumed no finalizers and only GC-managed = memory, I guess. Ludo=E2=80=99.