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 07:49:18 +0800 Message-ID: References: <20502.44997.295661.951990@vagabond.local> <878vdskmde.fsf@Kagami.home> <874nm75le8.fsf@gnu.org> <87y5ji2f1y.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 1349653783 3394 80.91.229.3 (7 Oct 2012 23:49:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 7 Oct 2012 23:49: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 01:49: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 1TL0bU-0002Ha-Rl for guile-bugs@m.gmane.org; Mon, 08 Oct 2012 01:49:48 +0200 Original-Received: from localhost ([::1]:51059 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TL0bO-0000JZ-LX for guile-bugs@m.gmane.org; Sun, 07 Oct 2012 19:49:42 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TL0bL-0000JM-Nn for bug-guile@gnu.org; Sun, 07 Oct 2012 19:49:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TL0bK-0003S5-E6 for bug-guile@gnu.org; Sun, 07 Oct 2012 19:49:39 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TL0bK-0003Rd-Aj for bug-guile@gnu.org; Sun, 07 Oct 2012 19:49:38 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TL0bi-0001Io-7Q for bug-guile@gnu.org; Sun, 07 Oct 2012 19:50:02 -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: Sun, 07 Oct 2012 23:50:02 +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.13496537924986 (code B ref 12095); Sun, 07 Oct 2012 23:50:02 +0000 Original-Received: (at 12095) by debbugs.gnu.org; 7 Oct 2012 23:49:52 +0000 Original-Received: from localhost ([127.0.0.1]:60435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TL0bX-0001IN-SL for submit@debbugs.gnu.org; Sun, 07 Oct 2012 19:49:52 -0400 Original-Received: from mail-wi0-f174.google.com ([209.85.212.174]:44163) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TL0bV-0001IA-7F for 12095@debbugs.gnu.org; Sun, 07 Oct 2012 19:49:50 -0400 Original-Received: by mail-wi0-f174.google.com with SMTP id hq7so2461878wib.15 for <12095@debbugs.gnu.org>; Sun, 07 Oct 2012 16:49:18 -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=C8rCCb9OfVg8qHcQEyGLLWi0P/wblcs0v9BeiyQvryc=; b=AJNMK8+D/XILHk9wJ91dFQZoCFze0mqX2CDXzXrog/a6MEwDfm0BXCTYz4TwW4hhb7 jK9eoItj9/BxShge7cwuXyR/qK+picoSns8CyE3XwRmsiNqwgVzwW87xDweSbliNNi2M 126kusuhdb1ijzYM1d1xdzNIa7hjdgLVUNSgZDPoiXsFeDfBDLUz8qeLAR8GQF+DSzET Zezg4WQ8gm780tvP2DvfVCCIF6wKcULjRPa2ZWHKiJB36DnpMqs+gnRGpnQOzqKQI3bP rYR/FSe+hGJNgO0wtqiN+JpoERku/5+L8kx/M7DsHhW7hhe3LyaInqlML/hCjWtVI4px 6//A== Original-Received: by 10.216.206.11 with SMTP id k11mr871228weo.81.1349653758672; Sun, 07 Oct 2012 16:49:18 -0700 (PDT) Original-Received: by 10.216.158.13 with HTTP; Sun, 7 Oct 2012 16:49:18 -0700 (PDT) In-Reply-To: <87y5ji2f1y.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:6546 Archived-At: On 8 October 2012 04:38, Ludovic Court=C3=A8s wrote: >>> This is expected to fail: =E2=80=98bytevector->pointer=E2=80=99 creates= a weak reference >>> from the returned pointer object to the given bytevector. So when the >>> pointer object is reclaimed, the bytevector can be reclaimed too, hence >>> the problem you=E2=80=99re observing. (And no, guardians don=E2=80=99t= protect objects >>> from garbage collection.) >> >> If I understand correctly, there is never any non-weak reference to >> the bv above and so it can be collected at any time. > > There=E2=80=99s a weak reference from the pointer object to the bytevecto= r. > > Once that pointer object has been collected (as in the example above), > the bytevector can be collected anytime. Right. But then the pointer is being collected even though it remains inside the guardian, in the example it is never extracted from there. I'm not sure I follow. :-/