* garbace collection of point-markers
@ 2003-01-31 8:49 Stefan Kamphausen
2003-01-31 10:10 ` Pascal Bourguignon
2003-01-31 19:02 ` Kevin Rodgers
0 siblings, 2 replies; 10+ messages in thread
From: Stefan Kamphausen @ 2003-01-31 8:49 UTC (permalink / raw)
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?
Or does the DONT-COPY-P argument achieve this?
I need this for a routine where I use lots of temporary markers.
Best Regards
Stefan Kamphausen
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: garbace collection of point-markers
2003-01-31 8:49 garbace collection of point-markers Stefan Kamphausen
@ 2003-01-31 10:10 ` Pascal Bourguignon
2003-01-31 15:18 ` Kai Großjohann
2003-01-31 16:13 ` Barry Margolin
2003-01-31 19:02 ` Kevin Rodgers
1 sibling, 2 replies; 10+ messages in thread
From: Pascal Bourguignon @ 2003-01-31 10:10 UTC (permalink / raw)
kamphausen@creativepharma.com (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)
> Or does the DONT-COPY-P argument achieve this?
Not even needed. What is it? Note that in emacs, the reader does not
convert-case the symbols. So (not (eq 'DONT-COPY-P 'dont-copy-p))
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------
There is a fault in reality. Do not adjust your minds. -- Salman Rushdie
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: garbace collection of point-markers
2003-01-31 10:10 ` Pascal Bourguignon
@ 2003-01-31 15:18 ` Kai Großjohann
2003-01-31 19:51 ` Pascal Bourguignon
2003-01-31 16:13 ` Barry Margolin
1 sibling, 1 reply; 10+ messages in thread
From: Kai Großjohann @ 2003-01-31 15:18 UTC (permalink / raw)
Pascal Bourguignon <pjb@informatimago.com> writes:
> Note that in emacs, the reader does not
> convert-case the symbols. So (not (eq 'DONT-COPY-P 'dont-copy-p))
It seems customary to refer to the args of a function by uppercase
names. Type C-h f kill-buffer RET for an example.
--
Ambibibentists unite!
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: garbace collection of point-markers
2003-01-31 15:18 ` Kai Großjohann
@ 2003-01-31 19:51 ` Pascal Bourguignon
2003-01-31 20:17 ` Barry Margolin
0 siblings, 1 reply; 10+ messages in thread
From: Pascal Bourguignon @ 2003-01-31 19:51 UTC (permalink / raw)
kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:
> Pascal Bourguignon <pjb@informatimago.com> writes:
>
> > Note that in emacs, the reader does not
> > convert-case the symbols. So (not (eq 'DONT-COPY-P 'dont-copy-p))
>
> It seems customary to refer to the args of a function by uppercase
> names. Type C-h f kill-buffer RET for an example.
Exact. But as a typographical distinction. Now that we have bolds and
italics and fonts, perhaps they should just be put in bold and stay
low case. When you work with Common-Lisp in addition to emacs lisp,
it's usefull to keep the distinction in mind.
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------
There is a fault in reality. Do not adjust your minds. -- Salman Rushdie
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: garbace collection of point-markers
2003-01-31 19:51 ` Pascal Bourguignon
@ 2003-01-31 20:17 ` Barry Margolin
2003-02-01 4:00 ` Pascal Bourguignon
0 siblings, 1 reply; 10+ messages in thread
From: Barry Margolin @ 2003-01-31 20:17 UTC (permalink / raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1041 bytes --]
In article <87vg05yu6h.fsf@thalassa.informatimago.com>,
Pascal Bourguignon <pjb@informatimago.com> wrote:
>kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:
>
>> Pascal Bourguignon <pjb@informatimago.com> writes:
>>
>> > Note that in emacs, the reader does not
>> > convert-case the symbols. So (not (eq 'DONT-COPY-P 'dont-copy-p))
>>
>> It seems customary to refer to the args of a function by uppercase
>> names. Type C-h f kill-buffer RET for an example.
>
>Exact. But as a typographical distinction. Now that we have bolds and
>italics and fonts, perhaps they should just be put in bold and stay
>low case. When you work with Common-Lisp in addition to emacs lisp,
>it's usefull to keep the distinction in mind.
Perhaps in Emacs documentation, but in Usenet you should limit yourself to
simple ASCII.
--
Barry Margolin, barmar@genuity.net
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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: garbace collection of point-markers
2003-01-31 20:17 ` Barry Margolin
@ 2003-02-01 4:00 ` Pascal Bourguignon
0 siblings, 0 replies; 10+ messages in thread
From: Pascal Bourguignon @ 2003-02-01 4:00 UTC (permalink / raw)
Barry Margolin <barmar@genuity.net> writes:
> In article <87vg05yu6h.fsf@thalassa.informatimago.com>,
> Pascal Bourguignon <pjb@informatimago.com> wrote:
> >kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:
> >
> >> Pascal Bourguignon <pjb@informatimago.com> writes:
> >>
> >> > Note that in emacs, the reader does not
> >> > convert-case the symbols. So (not (eq 'DONT-COPY-P 'dont-copy-p))
> >>
> >> It seems customary to refer to the args of a function by uppercase
> >> names. Type C-h f kill-buffer RET for an example.
> >
> >Exact. But as a typographical distinction. Now that we have bolds and
> >italics and fonts, perhaps they should just be put in bold and stay
> >low case. When you work with Common-Lisp in addition to emacs lisp,
> >it's usefull to keep the distinction in mind.
>
> Perhaps in Emacs documentation, but in Usenet you should limit yourself to
> simple ASCII.
What about _dont-copy-p_ or *dont-copy-p* ? (as viewed in gnus :-)
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------
There is a fault in reality. Do not adjust your minds. -- Salman Rushdie
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: garbace collection of point-markers
2003-01-31 10:10 ` Pascal Bourguignon
2003-01-31 15:18 ` Kai Großjohann
@ 2003-01-31 16:13 ` Barry Margolin
2003-01-31 17:21 ` Stefan Monnier <foo@acm.com>
1 sibling, 1 reply; 10+ messages in thread
From: Barry Margolin @ 2003-01-31 16:13 UTC (permalink / raw)
In article <87znphzl2d.fsf@thalassa.informatimago.com>,
Pascal Bourguignon <pjb@informatimago.com> wrote:
>
>kamphausen@creativepharma.com (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, barmar@genuity.net
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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: garbace collection of point-markers
2003-01-31 16:13 ` Barry Margolin
@ 2003-01-31 17:21 ` Stefan Monnier <foo@acm.com>
2003-02-03 18:04 ` Stefan Kamphausen
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2003-01-31 17:21 UTC (permalink / raw)
>>>>> "Barry" == Barry Margolin <barmar@genuity.net> writes:
> Your test seems to show that the markers are *not* cleaned up by the GC.
They definitely should. If they're not, it's a bug.
In the example posted by Pascal, it might simply be that the marker
is still referenced from the stack (more specifically, from a stack slot
which is actually dead, but the GC doesn't know it).
> 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.
Markers have been handled "weakly" for a long time and Emacs-21
additionally introduced weak hash tables. So, AFAIK it does ;-)
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: garbace collection of point-markers
2003-01-31 17:21 ` Stefan Monnier <foo@acm.com>
@ 2003-02-03 18:04 ` Stefan Kamphausen
0 siblings, 0 replies; 10+ messages in thread
From: Stefan Kamphausen @ 2003-02-03 18:04 UTC (permalink / raw)
Hi,
"Stefan Monnier <foo@acm.com>" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> wrote in message news:<5lptqd5j7m.fsf@rum.cs.yale.edu>...
> >>>>> "Barry" == Barry Margolin <barmar@genuity.net> writes:
> > Your test seems to show that the markers are *not* cleaned up by the GC.
>
> They definitely should. If they're not, it's a bug.
It would be very nice if they were GC'ed!
In the info chapter "Overview of Markers" it states that
"Unreferenced markers are garbage collected eventually, but until then
will continue to use time if they do point somewhere." (both for GE
and XE)
and that using
(set-marker MARKER nil)
is the correct way to mark them as unused.
If that is correct, then:
How could I test that? (A function like list-buffer-markers (similar
to list-itimers in XEmacs) would be nice for this, but I'd appreciate
any help with this)
I've read the markers chapter in XEmacs Internals where it states that
"Markers are removed from a buffer in the finalize stage, in
`ADDITIONAL_FREE_marker()'". I don't know how this applies to GNU
Emacs (for which I couldn't find a similar documentation), but it
sounds like markers can't be deleted w/o killing the buffer which
would be in clear contradiction with the citation from above (so I'm
probably getting something wrong here)
Thanks for your already enlightening discussion
and
Best Regards
Stefan Kamphausen
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: garbace collection of point-markers
2003-01-31 8:49 garbace collection of point-markers Stefan Kamphausen
2003-01-31 10:10 ` Pascal Bourguignon
@ 2003-01-31 19:02 ` Kevin Rodgers
1 sibling, 0 replies; 10+ messages in thread
From: Kevin Rodgers @ 2003-01-31 19:02 UTC (permalink / raw)
Stefan Kamphausen wrote:
> 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?
> Or does the DONT-COPY-P argument achieve this?
>
> I need this for a routine where I use lots of temporary markers.
Besides garbage collection, you may want to consider the performance
implications:
|File: elisp, Node: Overview of Markers, Next: Predicates on Markers, Up: Markers
...
| Insertion and deletion in a buffer must check all the markers and
|relocate them if necessary. This slows processing in a buffer with a
|large number of markers. For this reason, it is a good idea to make a
|marker point nowhere if you are sure you don't need it any more.
|Unreferenced markers are garbage collected eventually, but until then
|will continue to use time if they do point somewhere.
--
<a href="mailto:<kevin.rodgers@ihs.com>">Kevin Rodgers</a>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2003-02-03 18:04 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-31 8:49 garbace collection of point-markers Stefan Kamphausen
2003-01-31 10:10 ` Pascal Bourguignon
2003-01-31 15:18 ` Kai Großjohann
2003-01-31 19:51 ` Pascal Bourguignon
2003-01-31 20:17 ` Barry Margolin
2003-02-01 4:00 ` Pascal Bourguignon
2003-01-31 16:13 ` Barry Margolin
2003-01-31 17:21 ` Stefan Monnier <foo@acm.com>
2003-02-03 18:04 ` Stefan Kamphausen
2003-01-31 19:02 ` Kevin Rodgers
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.