diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/alloc.c b/src/alloc.c index 259143ffad8..8088540bb6b 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -23,6 +23,10 @@ Boston, MA 02110-1301, USA. */ | |||
| 23 | #include <stdio.h> | 23 | #include <stdio.h> |
| 24 | #include <limits.h> /* For CHAR_BIT. */ | 24 | #include <limits.h> /* For CHAR_BIT. */ |
| 25 | 25 | ||
| 26 | #ifdef STDC_HEADERS | ||
| 27 | #include <stddef.h> /* For offsetof, used by PSEUDOVECSIZE. */ | ||
| 28 | #endif | ||
| 29 | |||
| 26 | #ifdef ALLOC_DEBUG | 30 | #ifdef ALLOC_DEBUG |
| 27 | #undef INLINE | 31 | #undef INLINE |
| 28 | #endif | 32 | #endif |
| @@ -3005,13 +3009,17 @@ allocate_frame () | |||
| 3005 | struct Lisp_Process * | 3009 | struct Lisp_Process * |
| 3006 | allocate_process () | 3010 | allocate_process () |
| 3007 | { | 3011 | { |
| 3008 | EMACS_INT len = VECSIZE (struct Lisp_Process); | 3012 | /* Memory-footprint of the object in nb of Lisp_Object fields. */ |
| 3009 | struct Lisp_Vector *v = allocate_vectorlike (len, MEM_TYPE_PROCESS); | 3013 | EMACS_INT memlen = VECSIZE (struct Lisp_Process); |
| 3014 | /* Size if we only count the actual Lisp_Object fields (which need to be | ||
| 3015 | traced by the GC). */ | ||
| 3016 | EMACS_INT lisplen = PSEUDOVECSIZE (struct Lisp_Process, pid); | ||
| 3017 | struct Lisp_Vector *v = allocate_vectorlike (memlen, MEM_TYPE_PROCESS); | ||
| 3010 | EMACS_INT i; | 3018 | EMACS_INT i; |
| 3011 | 3019 | ||
| 3012 | for (i = 0; i < len; ++i) | 3020 | for (i = 0; i < lisplen; ++i) |
| 3013 | v->contents[i] = Qnil; | 3021 | v->contents[i] = Qnil; |
| 3014 | v->size = len; | 3022 | v->size = lisplen; |
| 3015 | 3023 | ||
| 3016 | return (struct Lisp_Process *) v; | 3024 | return (struct Lisp_Process *) v; |
| 3017 | } | 3025 | } |
| @@ -5563,6 +5571,10 @@ mark_object (arg) | |||
| 5563 | if (size & PSEUDOVECTOR_FLAG) | 5571 | if (size & PSEUDOVECTOR_FLAG) |
| 5564 | size &= PSEUDOVECTOR_SIZE_MASK; | 5572 | size &= PSEUDOVECTOR_SIZE_MASK; |
| 5565 | 5573 | ||
| 5574 | /* Note that this size is not the memory-footprint size, but only | ||
| 5575 | the number of Lisp_Object fields that we should trace. | ||
| 5576 | The distinction is used e.g. by Lisp_Process which places extra | ||
| 5577 | non-Lisp_Object fields at the end of the structure. */ | ||
| 5566 | for (i = 0; i < size; i++) /* and then mark its elements */ | 5578 | for (i = 0; i < size; i++) /* and then mark its elements */ |
| 5567 | mark_object (ptr->contents[i]); | 5579 | mark_object (ptr->contents[i]); |
| 5568 | } | 5580 | } |