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

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

Re: deleting contents of an array.


From: Johan Bockgård
Subject: Re: deleting contents of an array.
Date: Tue, 11 Mar 2008 14:08:41 +0100
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux)

Michal <rabbit50@tenbit.pl> writes:

> I created vector:
> (setq my-vec (make-vector 10 nil))
>
> then I added marker to it.
> (let ((m1 (make-marker)))
> (set-marker m1 (point) (current-buffer))
> (aset my-vec 3 m1))
>
> Then I decided to clean whole vector with:
> (fillarray my-vec nil)
>
> Will garbage collector take my no longer used element, that was on
> position 3 of vector, so that no memory leak will be present?

Yes, but

    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.

(info "(elisp) Overview of Markers")

-- 
Johan Bockgård


reply via email to

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