diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-01-02 18:02:32 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-01-02 18:11:25 -0800 |
commit | dd0e4d4e16fbbba6189610c7abb73d8b0efc6e5e (patch) | |
tree | e085817d80d71e20ec7230c9ed59a4793174f4d5 /lisp/emacs-lisp/cursor-sensor.el | |
parent | d36adb544d984b91c70f6194da01344e4b2b6fc9 (diff) | |
download | emacs-dd0e4d4e16fbbba6189610c7abb73d8b0efc6e5e.tar.gz emacs-dd0e4d4e16fbbba6189610c7abb73d8b0efc6e5e.tar.bz2 emacs-dd0e4d4e16fbbba6189610c7abb73d8b0efc6e5e.zip |
Let the OS clear large new objects
Prefer calloc to malloc+memset when allocating large zeroed objects.
This avoids page thrashing when (make-vector 1000000000 nil)
allocates a large nil vector, as Emacs need not touch the
vector’s pages. This wins on platforms like GNU/Linux where
calloc can fiddle with page tables to create a block of memory
that is lazily zeroed.
* src/alloc.c (lisp_malloc, lmalloc, allocate_vectorlike):
New arg CLEARIT to tell callee whether to use malloc or calloc.
All callers changed.
(allocate_clear_vector, allocate_nil_vector): New functions.
* src/alloc.c (xzalloc, make_vector):
* src/lisp.h (make_nil_vector):
Prefer calloc to malloc + memset(...,0,...).
Diffstat (limited to 'lisp/emacs-lisp/cursor-sensor.el')
0 files changed, 0 insertions, 0 deletions