* deleting contents of an array.
@ 2008-03-11 12:51 Michal
0 siblings, 0 replies; 3+ messages in thread
From: Michal @ 2008-03-11 12:51 UTC (permalink / raw)
To: emacs mailing list
Hallo group members.
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?
regards,
Michal
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: deleting contents of an array.
[not found] <mailman.8706.1205240079.18990.help-gnu-emacs@gnu.org>
@ 2008-03-11 13:08 ` Johan Bockgård
2008-03-11 13:50 ` Michal
0 siblings, 1 reply; 3+ messages in thread
From: Johan Bockgård @ 2008-03-11 13:08 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: deleting contents of an array.
2008-03-11 13:08 ` deleting contents of an array Johan Bockgård
@ 2008-03-11 13:50 ` Michal
0 siblings, 0 replies; 3+ messages in thread
From: Michal @ 2008-03-11 13:50 UTC (permalink / raw)
To: help-gnu-emacs
bojohan+news@dd.chalmers.se (Johan Bockgård) writes:
> 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.
Johan,
Thank You for suggestion
Regards,
Michal
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-11 13:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.8706.1205240079.18990.help-gnu-emacs@gnu.org>
2008-03-11 13:08 ` deleting contents of an array Johan Bockgård
2008-03-11 13:50 ` Michal
2008-03-11 12:51 Michal
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.