diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/alloc.c b/src/alloc.c index e3b65c1a4f4..5b42a0016a8 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3003,13 +3003,17 @@ allocate_frame () | |||
| 3003 | struct Lisp_Process * | 3003 | struct Lisp_Process * |
| 3004 | allocate_process () | 3004 | allocate_process () |
| 3005 | { | 3005 | { |
| 3006 | EMACS_INT len = VECSIZE (struct Lisp_Process); | 3006 | /* Memory-footprint of the object in nb of Lisp_Object fields. */ |
| 3007 | struct Lisp_Vector *v = allocate_vectorlike (len, MEM_TYPE_PROCESS); | 3007 | EMACS_INT memlen = VECSIZE (struct Lisp_Process); |
| 3008 | /* Size if we only count the actual Lisp_Object fields (which need to be | ||
| 3009 | traced by the GC). */ | ||
| 3010 | EMACS_INT lisplen = PSEUDOVECSIZE (struct Lisp_Process, pid); | ||
| 3011 | struct Lisp_Vector *v = allocate_vectorlike (memlen, MEM_TYPE_PROCESS); | ||
| 3008 | EMACS_INT i; | 3012 | EMACS_INT i; |
| 3009 | 3013 | ||
| 3010 | for (i = 0; i < len; ++i) | 3014 | for (i = 0; i < lisplen; ++i) |
| 3011 | v->contents[i] = Qnil; | 3015 | v->contents[i] = Qnil; |
| 3012 | v->size = len; | 3016 | v->size = lisplen; |
| 3013 | 3017 | ||
| 3014 | return (struct Lisp_Process *) v; | 3018 | return (struct Lisp_Process *) v; |
| 3015 | } | 3019 | } |
| @@ -5558,6 +5562,10 @@ mark_object (arg) | |||
| 5558 | if (size & PSEUDOVECTOR_FLAG) | 5562 | if (size & PSEUDOVECTOR_FLAG) |
| 5559 | size &= PSEUDOVECTOR_SIZE_MASK; | 5563 | size &= PSEUDOVECTOR_SIZE_MASK; |
| 5560 | 5564 | ||
| 5565 | /* Note that this size is not the memory-footprint size, but only | ||
| 5566 | the number of Lisp_Object fields that we should trace. | ||
| 5567 | The distinction is used e.g. by Lisp_Process which places extra | ||
| 5568 | non-Lisp_Object fields at the end of the structure. */ | ||
| 5561 | for (i = 0; i < size; i++) /* and then mark its elements */ | 5569 | for (i = 0; i < size; i++) /* and then mark its elements */ |
| 5562 | mark_object (ptr->contents[i]); | 5570 | mark_object (ptr->contents[i]); |
| 5563 | } | 5571 | } |