From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id WZelFmLOiGRD9QAASxT56A (envelope-from ) for ; Tue, 13 Jun 2023 22:15:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id EPTCFWLOiGRlLgEA9RJhRA (envelope-from ) for ; Tue, 13 Jun 2023 22:15:30 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1DB723ABA1 for ; Tue, 13 Jun 2023 22:15:30 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q98Gr-0001zo-O8; Tue, 13 Jun 2023 13:57:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q98Gq-0001zQ-Ab for emacs-orgmode@gnu.org; Tue, 13 Jun 2023 13:57:32 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q98Go-0003mJ-BN for emacs-orgmode@gnu.org; Tue, 13 Jun 2023 13:57:32 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 4459D240027 for ; Tue, 13 Jun 2023 19:57:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1686679047; bh=CE9ENdDx42xZpuJA3btBfC6DgzkeISuDdvhV4UOcrfo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=C1m8SxH/Qc65A+1DK5bVh+ku5FxIu6Q+A7IdJLxug7xPJxm0URS8U/4SNBeohqerV 4+sle9PnP7+Uz7hlcSJOkn/SaLbELInu5Pnz3z3AOjq757Q1Qrw4dg2vVkY3+yv1dv dALZJqRGnUG+VqOuYjSBofbM3LSOR/RdhJ71IR8ZNp4Sd908XHUq5VCQpRwAxYkUdX 5BEmynKmDXHbbWThek7jkQShgWgGPdzBIgSPr49fyBZptMGW670H2AzR4hPGCRgx5N o9Jpws9ktOYqwUwhMPxeaW6pAMx5MLl03lNvuggt/qi+apjg925TnsvcXarCQa1X8g f4L/w3rXThOkg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QgbqV5bHHz6tw9; Tue, 13 Jun 2023 19:57:26 +0200 (CEST) From: Ihor Radchenko To: Sebastian Cc: emacs-orgmode@gnu.org Subject: Re: Org element cache in indirect buffers In-Reply-To: References: <87o7lmb3ih.fsf@nixos.mail-host-address-is-not-set> <87v8funovi.fsf@localhost> <877cs7wt1n.fsf@localhost> Date: Tue, 13 Jun 2023 18:02:21 +0000 Message-ID: <87wn07qlzm.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1686687330; a=rsa-sha256; cv=none; b=Yy+9lM8QlhczuxsN3V21yPlTMnFUV5yQJbB6M44D5RkRWFT+FnIfk1q092JvTR/a54rH4D A4NyuSI95tAU/TrPxQn3P01WGqZWbenv/iiXlwib3O55BGbyR9Srnu0GB6zv3u4s8c+XIQ CsTYQG63OXxTKuj17hcLmuMrPSX1SO6n8DGIpFgXxg+ZadbNu4mtP2eOt9rG1Hmx6k9vK/ TSUsQHDdz+FZVDgwx7sTJfxDwF5+BDOPqi5JRs4WrQ9iyNGXvHS2wbePQndGLW0PT15gSQ 8fzoq8FJu5MAOkSLygg57UP07aKGNOWlqzQZyT4fkDEGnN13Ooc+zXUVSfCd3Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="C1m8SxH/"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1686687330; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=g9fYy61cRBkKeKvygr5yLDNoJduAnvopYDPwu63dWfE=; b=jjw0QGPGlaMSiL/2yZgQmihqWLtVi3QXjr2YF1A1CIUkKf3dvWr0DX+SZCUrjNewUs397p 3NP3MEkGIYWfUG/YopegX0rXkFkMIUZFkK0uRo7sLtjzsy0zvdoELFey4WYEajcZcbO22Q GH3g47dmRs094podKjSFtfhemdJ0ami3s5rzhs+HFRvn2Zlp0KQhTu6VipZnQeP7/a83fU tIDvVG8tcWXqDOkNj+ktGsKUcpgUk8A1DpFVwMhsheiQX8RCKMb1tRaeETo238TKA5+glU fdBtScQuMvfkXrY7biLEnBGDU2kIGKsoMzwVx5jeYpb1GjBZrjb8GzkgkZykpA== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="C1m8SxH/"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -7.49 X-Spam-Score: -7.49 X-Migadu-Queue-Id: 1DB723ABA1 X-TUID: X6AP997ntVCk [Adding Org ML back to CC] Sebastian writes: > Thank you so much for the detailed explanation! > > Maybe memory-report is counting what's at the end of the reference, and > your change fixes it. memory-report is counting buffer data separately, even when buffer-local variables reference to the same data objects. I just reported this upstream: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64050 My change simply clears the references to AVL-tree roots that are copied over when Emacs clones the buffer. The edge cases I was talking about are when the main AVL-tree changes its root. That would make indirect buffer actually keep reference to obsolete root and the rest of the obsolete AVL-tree, preventing it from being garbage-collected. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at