diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/alloc.c b/src/alloc.c index 36adb49f835..2fc93f825d1 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -264,6 +264,7 @@ static Lisp_Object Qintervals; | |||
| 264 | static Lisp_Object Qbuffers; | 264 | static Lisp_Object Qbuffers; |
| 265 | static Lisp_Object Qstring_bytes, Qvector_slots, Qheap; | 265 | static Lisp_Object Qstring_bytes, Qvector_slots, Qheap; |
| 266 | static Lisp_Object Qgc_cons_threshold; | 266 | static Lisp_Object Qgc_cons_threshold; |
| 267 | Lisp_Object Qautomatic_gc; | ||
| 267 | Lisp_Object Qchar_table_extra_slots; | 268 | Lisp_Object Qchar_table_extra_slots; |
| 268 | 269 | ||
| 269 | /* Hook run after GC has finished. */ | 270 | /* Hook run after GC has finished. */ |
| @@ -5421,6 +5422,7 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5421 | EMACS_TIME start; | 5422 | EMACS_TIME start; |
| 5422 | Lisp_Object retval = Qnil; | 5423 | Lisp_Object retval = Qnil; |
| 5423 | size_t tot_before = 0; | 5424 | size_t tot_before = 0; |
| 5425 | struct backtrace backtrace; | ||
| 5424 | 5426 | ||
| 5425 | if (abort_on_gc) | 5427 | if (abort_on_gc) |
| 5426 | abort (); | 5428 | abort (); |
| @@ -5430,6 +5432,14 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5430 | if (pure_bytes_used_before_overflow) | 5432 | if (pure_bytes_used_before_overflow) |
| 5431 | return Qnil; | 5433 | return Qnil; |
| 5432 | 5434 | ||
| 5435 | /* Record this function, so it appears on the profiler's backtraces. */ | ||
| 5436 | backtrace.next = backtrace_list; | ||
| 5437 | backtrace.function = &Qautomatic_gc; | ||
| 5438 | backtrace.args = &Qautomatic_gc; | ||
| 5439 | backtrace.nargs = 0; | ||
| 5440 | backtrace.debug_on_exit = 0; | ||
| 5441 | backtrace_list = &backtrace; | ||
| 5442 | |||
| 5433 | check_cons_list (); | 5443 | check_cons_list (); |
| 5434 | 5444 | ||
| 5435 | /* Don't keep undo information around forever. | 5445 | /* Don't keep undo information around forever. |
| @@ -5486,7 +5496,6 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5486 | shrink_regexp_cache (); | 5496 | shrink_regexp_cache (); |
| 5487 | 5497 | ||
| 5488 | gc_in_progress = 1; | 5498 | gc_in_progress = 1; |
| 5489 | is_in_trace = 1; | ||
| 5490 | 5499 | ||
| 5491 | /* Mark all the special slots that serve as the roots of accessibility. */ | 5500 | /* Mark all the special slots that serve as the roots of accessibility. */ |
| 5492 | 5501 | ||
| @@ -5538,8 +5547,6 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5538 | mark_backtrace (); | 5547 | mark_backtrace (); |
| 5539 | #endif | 5548 | #endif |
| 5540 | 5549 | ||
| 5541 | mark_profiler (); | ||
| 5542 | |||
| 5543 | #ifdef HAVE_WINDOW_SYSTEM | 5550 | #ifdef HAVE_WINDOW_SYSTEM |
| 5544 | mark_fringe_data (); | 5551 | mark_fringe_data (); |
| 5545 | #endif | 5552 | #endif |
| @@ -5607,7 +5614,6 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5607 | check_cons_list (); | 5614 | check_cons_list (); |
| 5608 | 5615 | ||
| 5609 | gc_in_progress = 0; | 5616 | gc_in_progress = 0; |
| 5610 | is_in_trace = 0; | ||
| 5611 | 5617 | ||
| 5612 | consing_since_gc = 0; | 5618 | consing_since_gc = 0; |
| 5613 | if (gc_cons_threshold < GC_DEFAULT_THRESHOLD / 10) | 5619 | if (gc_cons_threshold < GC_DEFAULT_THRESHOLD / 10) |
| @@ -5720,24 +5726,19 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5720 | gcs_done++; | 5726 | gcs_done++; |
| 5721 | 5727 | ||
| 5722 | /* Collect profiling data. */ | 5728 | /* Collect profiling data. */ |
| 5723 | if (sample_profiler_running || memory_profiler_running) | 5729 | if (memory_profiler_running) |
| 5724 | { | 5730 | { |
| 5725 | size_t swept = 0; | 5731 | size_t swept = 0; |
| 5726 | size_t elapsed = 0; | ||
| 5727 | if (memory_profiler_running) | 5732 | if (memory_profiler_running) |
| 5728 | { | 5733 | { |
| 5729 | size_t tot_after = total_bytes_of_live_objects (); | 5734 | size_t tot_after = total_bytes_of_live_objects (); |
| 5730 | if (tot_before > tot_after) | 5735 | if (tot_before > tot_after) |
| 5731 | swept = tot_before - tot_after; | 5736 | swept = tot_before - tot_after; |
| 5732 | } | 5737 | } |
| 5733 | if (sample_profiler_running) | 5738 | malloc_probe (swept); |
| 5734 | { | ||
| 5735 | EMACS_TIME since_start = sub_emacs_time (current_emacs_time (), start); | ||
| 5736 | elapsed = EMACS_TIME_TO_DOUBLE (since_start) * 1000; | ||
| 5737 | } | ||
| 5738 | gc_probe (swept, elapsed); | ||
| 5739 | } | 5739 | } |
| 5740 | 5740 | ||
| 5741 | backtrace_list = backtrace.next; | ||
| 5741 | return retval; | 5742 | return retval; |
| 5742 | } | 5743 | } |
| 5743 | 5744 | ||
| @@ -6867,6 +6868,7 @@ do hash-consing of the objects allocated to pure space. */); | |||
| 6867 | DEFSYM (Qstring_bytes, "string-bytes"); | 6868 | DEFSYM (Qstring_bytes, "string-bytes"); |
| 6868 | DEFSYM (Qvector_slots, "vector-slots"); | 6869 | DEFSYM (Qvector_slots, "vector-slots"); |
| 6869 | DEFSYM (Qheap, "heap"); | 6870 | DEFSYM (Qheap, "heap"); |
| 6871 | DEFSYM (Qautomatic_gc, "Automatic GC"); | ||
| 6870 | 6872 | ||
| 6871 | DEFSYM (Qgc_cons_threshold, "gc-cons-threshold"); | 6873 | DEFSYM (Qgc_cons_threshold, "gc-cons-threshold"); |
| 6872 | DEFSYM (Qchar_table_extra_slots, "char-table-extra-slots"); | 6874 | DEFSYM (Qchar_table_extra_slots, "char-table-extra-slots"); |