unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Is there any possible memory leak in GC?
@ 2007-12-13 15:21 Herbert Euler
  2007-12-13 16:36 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Herbert Euler @ 2007-12-13 15:21 UTC (permalink / raw)
  To: emacs-devel


Hello,

Here is just a possibly stupid question on GC.

After watching the use of `cons_free_list', I am confused about it.
`cons_free_list' holds the unmarked cons cells during GC sweeping.
When `cons' creates new cons cells, it picks any ones in
`cons_free_list' if possible.  But each time when sweeping happens,
`cons_free_list' is reset to 0, and its previous value is lost.  Since
GC can run at any time with `garbage-collect', will this lead to
memory leak or not?

Regards,
Guanpeng Xu
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Is there any possible memory leak in GC?
  2007-12-13 15:21 Is there any possible memory leak in GC? Herbert Euler
@ 2007-12-13 16:36 ` Stefan Monnier
  2007-12-13 23:48   ` Herbert Euler
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2007-12-13 16:36 UTC (permalink / raw)
  To: Herbert Euler; +Cc: emacs-devel

> After watching the use of `cons_free_list', I am confused about it.
> `cons_free_list' holds the unmarked cons cells during GC sweeping.
> When `cons' creates new cons cells, it picks any ones in
> `cons_free_list' if possible.  But each time when sweeping happens,
> `cons_free_list' is reset to 0, and its previous value is lost.  Since
> GC can run at any time with `garbage-collect', will this lead to
> memory leak or not?

No, it should not lead to any leak because it will find all the cells
that were still on the cons_free_list and add them back, while sweeping
the cons blocks.


        Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Is there any possible memory leak in GC?
  2007-12-13 16:36 ` Stefan Monnier
@ 2007-12-13 23:48   ` Herbert Euler
  0 siblings, 0 replies; 3+ messages in thread
From: Herbert Euler @ 2007-12-13 23:48 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel


>> After watching the use of `cons_free_list', I am confused about it.
>> `cons_free_list' holds the unmarked cons cells during GC sweeping.
>> When `cons' creates new cons cells, it picks any ones in
>> `cons_free_list' if possible. But each time when sweeping happens,
>> `cons_free_list' is reset to 0, and its previous value is lost. Since
>> GC can run at any time with `garbage-collect', will this lead to
>> memory leak or not?
>
> No, it should not lead to any leak because it will find all the cells
> that were still on the cons_free_list and add them back, while sweeping
> the cons blocks.

Ah, I have found the gap between my understanding and the
fact.  Thank you! :D

Regards,
Guanpeng Xu
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-12-13 23:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-13 15:21 Is there any possible memory leak in GC? Herbert Euler
2007-12-13 16:36 ` Stefan Monnier
2007-12-13 23:48   ` Herbert Euler

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).