emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Emacs allocates unnecessary memory during scrolling


From: MIYOSHI Masanori
Subject: Emacs allocates unnecessary memory during scrolling
Date: Mon, 16 Oct 2006 23:23:06 +0900
User-agent: Gnus/5.110006 (No Gnus v0.6) Meadow-3.00-dev (KIKU)

Emacs 22 on Windows (and probably on other platforms) allocates
unnecessary memory during scrolling.

The following opearaion reproduces the problem.

o emacs -q
o Evaluate (setq scroll-conservatively 10) on the scratch buffer.
o Type `C-h' to view the HELLO file.
o Type `C-n' on to scroll the window.
o Emacs allocates unnecessary memory during scrolling.

Large files which contains multibyte characters should be better
for reproduction.


Findings are:

This changes seems to have revealed the problem.
> 2006-09-06  Kim F. Storm  <address@hidden>
> 
>       * xdisp.c (pos_visible_p): Remove exact_mode_line_heights_p arg;
>       so calculate heights even when pos-visible-in-window-p is called
>       with partially = t.  Don't overshoot last_visible_y in move_it_to.
>       Return row height and row number in new rowh and vpos args.

In the following call sequences, it->w->ncols_scale_factor is
incremented a number of times.

In xdisp.c:
pos_visible_p()
-> display_mode_line()
-> display_mode_element() ;; case MODE_LINE_DISPLAY:
-> display_string()
-> PRODUCE_GLYPHS()
-> x_produce_glyphs() ;; RIF
-> append_glyph() ;; it->glyph_row->used[area]++
-> IT_EXPAND_MATRIX_WIDTH() ;; it->w->ncols_scale_factor++

In consequence, required_matrix_width() in dispnew.c returns a
large number.  And adjust_glyph_matrix() in dispnew.c allocates
unnecessary large memory for glyphs.


YAMAMOTO Mitsuharu san says:

In xdisp.c:
> static int
> display_mode_line (w, face_id, format)
snip
> {
snip
>   init_iterator (&it, w, -1, -1, NULL, face_id);
>   prepare_desired_row (it.glyph_row);

Before prepare_desired_row(), it.glyph_row->enabled_p happens not
to be 0.  This might be caused by the interruption of redisplay
during scrolling.

Appending the next code before prepare_desired_row() may fix the
problem.
> it.glyph_row->enabled_p = 0;
But he doesn't know the place is appropriate or not.

--
MIYOSHI Masanori




reply via email to

[Prev in Thread] Current Thread [Next in Thread]