help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

When are unused overlays garbage collected?


From: Marcin Borkowski
Subject: When are unused overlays garbage collected?
Date: Mon, 24 May 2021 07:00:54 +0200
User-agent: mu4e 1.1.0; emacs 28.0.50

Hi all,

the Elisp reference says that the `delete-overlay' function does not
entirely delete the overlay (in a sense):

--8<---------------cut here---------------start------------->8---
The overlay continues to exist as a Lisp object, and its property list
is unchanged, but it ceases to be attached to the buffer it belonged to,
and ceases to have any effect on display.

A deleted overlay is not permanently disconnected.  You can give it
a position in a buffer again by calling ‘move-overlay’.
--8<---------------cut here---------------end--------------->8---

So I assume that if I `delete-overlay', it means it cannot be
necessarily garbage-collected yet.  So, when /can/ an overlay be really
"deleted", meaning the memory it occupied is freed?

My guess would be that if the overlay is "deleted" (so it is not
attached to any buffer, either by means of `delete-overlay' or when its
buffer is killed) /and/ it can't be referenced from Elisp (e.g., there
is no variable bound to it).  This would make sense, because even if
there is no variable bound to an overlay which is not deleted, you can
still get a reference to it using any of the overlay-finding functions
(`overlays-at' or `overlays-in').

Am I correct?

--
Marcin Borkowski
http://mbork.pl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]