From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Hartwig Newsgroups: gmane.lisp.guile.bugs Subject: bug#12095: Protecting pointer on bytevector with guardian does not protect memory Date: Mon, 8 Oct 2012 22:10:54 +0800 Message-ID: References: <20502.44997.295661.951990@vagabond.local> <878vdskmde.fsf@Kagami.home> <874nm75le8.fsf@gnu.org> <87y5ji2f1y.fsf@gnu.org> <874nm584dq.fsf@gnu.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 1349705503 10549 80.91.229.3 (8 Oct 2012 14:11:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Oct 2012 14:11:43 +0000 (UTC) Cc: 12095@debbugs.gnu.org, Ian Price To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Oct 08 16:11:49 2012 Return-path: Envelope-to: guile-bugs@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 1TLE3g-0003cY-6c for guile-bugs@m.gmane.org; Mon, 08 Oct 2012 16:11:48 +0200 Original-Received: from localhost ([::1]:39869 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLE3Z-000357-V0 for guile-bugs@m.gmane.org; Mon, 08 Oct 2012 10:11:41 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLE3W-00034x-FF for bug-guile@gnu.org; Mon, 08 Oct 2012 10:11:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLE3S-00040q-AV for bug-guile@gnu.org; Mon, 08 Oct 2012 10:11:38 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLE3S-00040m-6k for bug-guile@gnu.org; Mon, 08 Oct 2012 10:11:34 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TLE3t-0000GX-O3 for bug-guile@gnu.org; Mon, 08 Oct 2012 10:12:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Hartwig Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 08 Oct 2012 14:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12095 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 12095-submit@debbugs.gnu.org id=B12095.1349705490972 (code B ref 12095); Mon, 08 Oct 2012 14:12:01 +0000 Original-Received: (at 12095) by debbugs.gnu.org; 8 Oct 2012 14:11:30 +0000 Original-Received: from localhost ([127.0.0.1]:33635 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TLE3N-0000Fc-Su for submit@debbugs.gnu.org; Mon, 08 Oct 2012 10:11:30 -0400 Original-Received: from mail-ob0-f172.google.com ([209.85.214.172]:42678) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TLE3L-0000FQ-Nx for 12095@debbugs.gnu.org; Mon, 08 Oct 2012 10:11:29 -0400 Original-Received: by mail-ob0-f172.google.com with SMTP id v19so3664117obq.3 for <12095@debbugs.gnu.org>; Mon, 08 Oct 2012 07:10:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=cZwfXQuPw95ypJEcGCAO7S3vaT+2NWqUzrvnBx+xpf0=; b=KejloOGUiKUUJp7IAzevDaepUmyBJpiG/iY2Xqe/sQ9m9IYsQ6KfpxDRE2RTxvTNGf /sHvpJj+mQ5U0mHb+9uBCGi3UIxE2wQJJyEdExOqknYE2716BDT8gmz3hkRBImFeFwjP FjwzT2AyFuPkf6au7lPKRGgf3iCvWomZp4LmRa8jqOChvQ1gLqSF6kIeZ7pbpcnOniiS A5xdZGVJDQfRsvgCrzGn6viT5nKw9Pk3oIutQp5n3QxQC8JxtR4oY6bF7g8KO5TSVGc6 bhEJwetg0RH2jryxO9SxaB3wXP2q8nRj6r7Bk5+hC7/RVY/leCu8ikxPZeS1cB3XmeN5 jNww== Original-Received: by 10.182.50.103 with SMTP id b7mr201496obo.15.1349705454269; Mon, 08 Oct 2012 07:10:54 -0700 (PDT) Original-Received: by 10.60.56.41 with HTTP; Mon, 8 Oct 2012 07:10:54 -0700 (PDT) In-Reply-To: <874nm584dq.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:6548 Archived-At: On 8 October 2012 21:44, Ludovic Court=C3=A8s wrote: >> On 8 October 2012 04:38, Ludovic Court=C3=A8s wrote: >> Right. But then the pointer is being collected even though it remains >> inside the guardian, in the example it is never extracted from there. > > Well, when the object reaches the guardian=E2=80=99s zombie list, that=E2= =80=99s because > it=E2=80=99s been finalized, so any weak references from that object can = also be > nullified. Ah. So I thought that being in the zombie list prevented any finalization, thus when the guardian returns an object it is still fully functional and only after the reference is lost again does it really get finalized. I will have to reread the doc for make-guardian where it talks about the weak links, perhaps with a healthy amount of source-code inspection ;-) Admittedly the test case here is quite contrived, and I agreed with your next remark in the original (pre-bug-report) thread. > Anyway, guardians are not a mechanism to protect objects from being > GC=E2=80=99d. To prevent the bytevector from being GC=E2=80=99d, you sho= uld either keep > the pointer object or the bytevector itself in non-GC=E2=80=99d memory, s= uch as > a global variable or hash table. Yes. The intended use was obviously troubled, but it still seemed odd about the guardian's lack of protection. > How does it help? Should we close the bug? :-) Sure. At least you seem convinced and you has actually hacked on it :-) Regards