From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alin Soare Newsgroups: gmane.emacs.devel Subject: Re: please help about the implementation of GC. Date: Sun, 30 Oct 2011 20:27:33 +0200 Message-ID: References: <838vo28ix9.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d044473919ee9bc04b08846cf X-Trace: dough.gmane.org 1319999265 15231 80.91.229.12 (30 Oct 2011 18:27:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 30 Oct 2011 18:27:45 +0000 (UTC) Cc: Andreas Schwab , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 30 19:27:41 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RKa6f-0007DO-1O for ged-emacs-devel@m.gmane.org; Sun, 30 Oct 2011 19:27:41 +0100 Original-Received: from localhost ([::1]:40679 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKa6e-0008Pv-EG for ged-emacs-devel@m.gmane.org; Sun, 30 Oct 2011 14:27:40 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:33118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKa6b-0008Pb-7u for emacs-devel@gnu.org; Sun, 30 Oct 2011 14:27:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RKa6a-0007gk-5y for emacs-devel@gnu.org; Sun, 30 Oct 2011 14:27:37 -0400 Original-Received: from mail-gy0-f169.google.com ([209.85.160.169]:56144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKa6Y-0007g9-JK; Sun, 30 Oct 2011 14:27:34 -0400 Original-Received: by gyg8 with SMTP id 8so383944gyg.0 for ; Sun, 30 Oct 2011 11:27:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=fDP6AtDIZsxHUZFgj1m67BLzvooMSeshii4SiHZdTII=; b=bwK/usfAOhCLxzWYEb/PEtQe6b00PocPBh7tf5rtERoYiYjoELprum70GzepeF/VG2 adKQKXjp90/9Rbe7REX52rgnhCXiCR7lVCTXr0SKGvTa1p7Hwa865d9Yakq0Mg3E7rNE ShOzdsKskkbQYHbAiavRloUxJGkVIC1ntpzso= Original-Received: by 10.182.227.41 with SMTP id rx9mr2256579obc.12.1319999253702; Sun, 30 Oct 2011 11:27:33 -0700 (PDT) Original-Received: by 10.182.112.100 with HTTP; Sun, 30 Oct 2011 11:27:33 -0700 (PDT) In-Reply-To: <838vo28ix9.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.160.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:145804 Archived-At: --f46d044473919ee9bc04b08846cf Content-Type: text/plain; charset=UTF-8 > > > I wish to read the algorithm of gc, and I cannot. > > > > The Emacs gc is a simple mark and sweep collector. > > Right. > > Alin, you can start by reading the node "Garbage Collection" in the > ELisp manual, and then proceed reading alloc.c, where you will see > many functions named mark_SOMETHING and then gc_sweep that does the > sweep stage. If you want more background before reading the ELisp > manual, try googling "mark and sweep garbage collection". > I have read the mark-sweep algorithm; I know it. However, I do not manage making the connection with alloc.c. For example, I cannot understand what kind of objects are kept in every node of the red-black tree (in books I never saw gc implemented with red-black trees). I know that the objects are kept in obarrays. What link is there between obarrays and red-black tree of gc ? What happens to a Lisp_Object defined in C code? Is it freed if it is found by conservative stack algorithm ? What is the link between GCPRO? macros and the gc ? --f46d044473919ee9bc04b08846cf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
> > I wish to read the algorithm of gc, and I cannot.
>
> The Emacs gc is a simple mark and sweep collector.

Right.

Alin, you can start by reading the node "Garbage Collection" in t= he
ELisp manual, and then proceed reading alloc.c, where you will see
many functions named mark_SOMETHING and then gc_sweep that does the
sweep stage. =C2=A0If you want more background before reading the ELisp
manual, try googling "mark and sweep garbage collection".

I have read the mark-sweep algorithm; I know it. However,= I do not manage making the connection with alloc.c.

For example, I= cannot understand what kind of objects are kept in every node of the red-b= lack tree=C2=A0 (in books I never saw gc implemented with red-black trees).= I know that the objects are kept in obarrays. What link is there between o= barrays and red-black tree of gc ?

What happens to a Lisp_Object defined in C code? Is it freed if it is f= ound by conservative stack algorithm ? What is the link between GCPRO? macr= os and the gc ?








=C2=A0

--f46d044473919ee9bc04b08846cf--