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

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

Re: garbace collection of point-markers


From: Barry Margolin
Subject: Re: garbace collection of point-markers
Date: Fri, 31 Jan 2003 16:13:30 GMT

In article <address@hidden>,
Pascal Bourguignon  <address@hidden> wrote:
>
>address@hidden (Stefan Kamphausen) writes:
>
>> Dear ElispWizards,
>> 
>> when I call (point-marker) and don't store the return value in a
>> variable will that marker be removed at the next garbage collection?
>
>It seems so:
> 
>(show (let ((curpt (point)))
>        (set-marker (make-marker) curpt)
>        (cons (buffer-has-markers-at curpt)
>              (progn (garbage-collect)
>                     (buffer-has-markers-at curpt)))))
>==> (t . t)

Your test seems to show that the markers are *not* cleaned up by the GC.

Buffers keep track of the markers that point to them (so that they can be
updated when the buffer is modified), and that keeps them from becoming
garbage until the buffer is killed.  This would be an ideal application for
"weak" references if Emacs Lisp had them, but AFAIK it doesn't.

-- 
Barry Margolin, address@hidden
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.


reply via email to

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