From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: Collecting markers with MPS Date: Wed, 24 Apr 2024 18:21:22 +0200 Message-ID: <87jzkmivel.fsf@gmail.com> References: <87cyqfjk6n.fsf@gmail.com> <86sezb2oj2.fsf@gnu.org> <874jbrjg04.fsf@gmail.com> <86o79z2h7y.fsf@gnu.org> <87wmomiz0x.fsf@gmail.com> <86bk5y3gf4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23453"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: gerd.moellmann@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Apr 24 18:22:34 2024 Return-path: Envelope-to: ged-emacs-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 1rzfOC-0005yH-I8 for ged-emacs-devel@m.gmane-mx.org; Wed, 24 Apr 2024 18:22:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzfNE-0005gB-Cr; Wed, 24 Apr 2024 12:21:32 -0400 Original-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 1rzfNB-0005fH-2u for emacs-devel@gnu.org; Wed, 24 Apr 2024 12:21:29 -0400 Original-Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzfN8-00057U-Dv; Wed, 24 Apr 2024 12:21:28 -0400 Original-Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-56e47843cc7so6343516a12.0; Wed, 24 Apr 2024 09:21:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713975684; x=1714580484; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=HwtZE7B9oSlDso2j0hc+vvy7zwFcaO0K8fk0FBkldYs=; b=NIAnCLjWdZ2pnRjZOaFDunq3gGz+zOhU/bPRh/DXWB8V3nf3Jv/ptKxGl0hPcYJYX+ vDmRpJYzjrLpGisAu6GW6IZJF0c1yxFosFWRTHCKJbGiJu2PRjTc/733fTJ8oWyEb0gu B2psGxgKwkUfTZRWGQYIXGUZlhsq+LJNQWoYNeK6dhSVoVtlI8JrL78/um6nbfRmuMPU sGCdsyypm+EO1KfEy3wTX9x54IHB299Q46yxA+wMOIGYvltv5TTv0BR6vB9eDwpk3KQC JBJu946wF+L/4aZNE3qy4fP5oJYnZGjfXv8IqR/Y8sYZit3s+aJYIdD6rGRhkWbwX0Da ll3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713975684; x=1714580484; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HwtZE7B9oSlDso2j0hc+vvy7zwFcaO0K8fk0FBkldYs=; b=tC3DzAESC9EXSoTrDsAPsJv5G3iFaRJzHZcDI6GssHGDWluWNRJ8N54EFUuA9F2avg dZB+FvfmDQxbP761IguQ1JhMW4FQXwuacxH2/9ShKnDFfAcmwh8llTCVXZOiit/G/olo cPEgHw6vomJT1pBhpWxxKqqGGbeUwktFYVeAzDeXfW0mRSK4eVqRdw/N6Atz6IIGNI0X iFhXPTF7u9uSqjAH6Jop9HUk965DB7u+Oi0DUiVwFNf0Qi53HojbL5KnIx/P3z4iOS+5 AOm7nEHbbPA8d1G4oii2mxco+PIo941QuiFY2rXDB9cYn2D7pdCKZPJqinyLHmV8iAGo NhLQ== X-Forwarded-Encrypted: i=1; AJvYcCWwbTPB+/RKCp4K+T4PpAwoOSuhS7Sg3/P7S1FKybc2nx5vxN1zO5lJONv9hjYGgruwwGfGi6OHUn1xaCB3ePWebPWM X-Gm-Message-State: AOJu0YwWERESBM+iHXS+66nmp9OsXb3GRnkPE8po8hfLjtEaqm2F/cCs Sb5LERHtuuFlmdJHfY81ZvumWgIcJGKVBqt61Tb9nwH2WxyiRCJYOOOF6Q== X-Google-Smtp-Source: AGHT+IHhN2iY622APfOoTbOrMahAcbT5Umw3Ek455WHR2n5qk6Y6E4osd3dro2QUGheMeDzcgBk2KA== X-Received: by 2002:a17:906:7045:b0:a52:3ecb:ad83 with SMTP id r5-20020a170906704500b00a523ecbad83mr1917527ejj.38.1713975684134; Wed, 24 Apr 2024 09:21:24 -0700 (PDT) Original-Received: from caladan ([89.107.106.118]) by smtp.gmail.com with ESMTPSA id z18-20020a170906435200b00a4e657a5f1asm8475807ejm.112.2024.04.24.09.21.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 09:21:23 -0700 (PDT) In-Reply-To: <86bk5y3gf4.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 24 Apr 2024 18:54:07 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=eller.helmut@gmail.com; helo=mail-ed1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:318036 Archived-At: On Wed, Apr 24 2024, Eli Zaretskii wrote: >> We don't need it for correctness. We would unlikely run out of memory. > > Are you sure? Emacs could easily create gobs of markers. For > example, if there are buffers with lost of non-ASCII characters, each > time we need to compute character position from byte position or vice > versa, we create more markers in the buffer. In a session that runs > for weeks, there could be a lot of them, I think. Maybe those people who run Emacs for weeks can afford new Macbooks so that they can it run for months :-) >> We could also provide functions to manually unlink markers from the >> buffer that programmers could use to keep the slowness in check. > > If we can do this manually, we should be able to do it from a timer, > no? Yes, but only the programmers know which markers they no longer need. >> The MPS supports finalization and weak references. Finalization could >> tell us which markers are unreferenced. The problem is that markers >> stay referenced as long as they are part of the buffer's marker-chain or >> the undo-list. >> >> That's why we could use weak references here. If a marker is referenced >> only through weak references then MPS can collect it. MPS will also set >> the weak reference to 0 when the marker has been collected. So that we >> know when we no longer can/need to update the marker. >> >> The old GC knows which references are weak; that's what the special code >> there is for. For MPS, we somehow need to tell it which references are >> weak. > > So why did you say this will take much more code than in the old GC? Because I think introducing those weak reference objects in the marker-chain needs quite a number of changes. It's like changing a foo* to a foo**. Simple conceptually, but many places need to be touched. Most of the changes should be straightforward, I hope. Helmut