Mercurial > emacs
diff src/alloc.c @ 90381:65ca8fb66a0d
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-54
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 190-203)
- Update from CVS
- Undo incorrect merge of etc/images/README from Gnus 5.10
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 74-80)
- Update from CVS
- Update from CVS: README: Addition from 5.10.6 tar ball.
| author | Miles Bader <miles@gnu.org> |
|---|---|
| date | Sun, 09 Apr 2006 00:38:22 +0000 |
| parents | 494bf720eaf0 272487a77b8e |
| children | 8a8e69664178 |
line wrap: on
line diff
--- a/src/alloc.c Fri Apr 07 12:02:40 2006 +0000 +++ b/src/alloc.c Sun Apr 09 00:38:22 2006 +0000 @@ -23,6 +23,10 @@ #include <stdio.h> #include <limits.h> /* For CHAR_BIT. */ +#ifdef STDC_HEADERS +#include <stddef.h> /* For offsetof, used by PSEUDOVECSIZE. */ +#endif + #ifdef ALLOC_DEBUG #undef INLINE #endif @@ -3003,13 +3007,17 @@ struct Lisp_Process * allocate_process () { - EMACS_INT len = VECSIZE (struct Lisp_Process); - struct Lisp_Vector *v = allocate_vectorlike (len, MEM_TYPE_PROCESS); + /* Memory-footprint of the object in nb of Lisp_Object fields. */ + EMACS_INT memlen = VECSIZE (struct Lisp_Process); + /* Size if we only count the actual Lisp_Object fields (which need to be + traced by the GC). */ + EMACS_INT lisplen = PSEUDOVECSIZE (struct Lisp_Process, pid); + struct Lisp_Vector *v = allocate_vectorlike (memlen, MEM_TYPE_PROCESS); EMACS_INT i; - for (i = 0; i < len; ++i) + for (i = 0; i < lisplen; ++i) v->contents[i] = Qnil; - v->size = len; + v->size = lisplen; return (struct Lisp_Process *) v; } @@ -5515,6 +5523,10 @@ if (size & PSEUDOVECTOR_FLAG) size &= PSEUDOVECTOR_SIZE_MASK; + /* Note that this size is not the memory-footprint size, but only + the number of Lisp_Object fields that we should trace. + The distinction is used e.g. by Lisp_Process which places extra + non-Lisp_Object fields at the end of the structure. */ for (i = 0; i < size; i++) /* and then mark its elements */ mark_object (ptr->contents[i]); }
