[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mem_insert, etc
From: |
Gerd Moellmann |
Subject: |
Re: mem_insert, etc |
Date: |
29 Dec 2001 13:49:25 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.50 |
Richard Stallman <address@hidden> writes:
> Could someone please document with comments in alloc.c the overall
> purpose of lisp_malloc, and mem_insert and friends? All it says about
> mem_insert and friends is that they are "for stack marking", but it does
> not say how they relate to it or why they exist.
I've added the comment below.
Index: alloc.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/alloc.c,v
retrieving revision 1.258
diff -c -c -r1.258 alloc.c
*** alloc.c 16 Dec 2001 21:52:36 -0000 1.258
--- alloc.c 29 Dec 2001 12:46:54 -0000
***************
*** 2711,2716 ****
--- 2711,2727 ----
#if GC_MARK_STACK || defined GC_MALLOC_CHECK
+ /* Conservative C stack marking requires a method to identify possibly
+ live Lisp objects given a pointer value. We do this by keeping
+ track of blocks of Lisp data that are allocated in a red-black tree
+ (see also the comment of mem_node which is the type of nodes in
+ that tree). Function lisp_malloc adds information for an allocated
+ block to the red-black tree with calls to mem_insert, and function
+ lisp_free removes it with mem_delete. Functions live_string_p etc
+ call mem_find to lookup information about a given pointer in the
+ tree, and use that to determine if the pointer points to a Lisp
+ object or not. */
+
/* Initialize this part of alloc.c. */
static void
- mem_insert, etc, Richard Stallman, 2001/12/29
- Re: mem_insert, etc,
Gerd Moellmann <=