最近我发现Emacs总是不时的莫名其妙的卡顿。我打开htop查看最高资源占用的进程,发现竟然不是Firefox(我开启了几十个标签页。。。。),而是Emacs。如下截图:
请问各位大神,有没有什么办法能够找出Emacs占用这么多内存的原因?需要用到什么工具么?
最近我发现Emacs总是不时的莫名其妙的卡顿。我打开htop查看最高资源占用的进程,发现竟然不是Firefox(我开启了几十个标签页。。。。),而是Emacs。如下截图:
请问各位大神,有没有什么办法能够找出Emacs占用这么多内存的原因?需要用到什么工具么?
M-x memory-usage
也有可能是subprocess开太多了
截图显示你的 Emacs 用了 1039 M,我的 Emacs 用了 200+M,你的明显偏高,Emacs 是个编辑器,是不是你打开了太多、太大的文件、图片等?比如如果你现在打开一个 100 MB 文件,Emacs 的内存使用会立马增加 100 MB
# 生成一个约 100MB 文件
dd if=/dev/urandom of=x bs=102400 count=1024
还有就是有没有可能你的 Emacs 保存了太多大数据到内存中,比如保存到一个 100 MB 的字符串,Emacs 内存使用同样会立马增加 100 MB
;; 生成一个长度 100 * 10^6 的字符串 (约 100MB)
(progn (setq x (make-string (truncate 100e6) ?x))
nil)
第一个问题的解决办法是把文件(不要忘记后台 Buffer)关掉,第二个问题的解决办法是把变量释放掉 (setq x "")
。
subprocess 本身对父进程没影响,比如截图中的 java 就是 emacs 的子进程,但它们之间的通信会影响 Emacs。
主要占用资源的子进程是 ejc-sql
开启的 CIDER REPL。
所有子进程如下 (list-processes
):
*mu4e-proc* 9043 run *mu4e-proc* -- Main /home/stardiviner/bin/mu server
*eaf* 10484 run *eaf* /dev/pts/6 Main python3 /home/stardiviner/Code/Emacs/emacs-application-framework/eaf.py 2560 1527 /home/stardiviner/.config/emacs/eaf/ {"eaf-camera-save-path":"~","eaf-browser-enable-plugin":"true","eaf-browser-enable-javascript":"true","eaf-browser-remember-history":"true","eaf-browser-default-zoom":"2","eaf-browser-blank-page-url":"https://www.google.com","eaf-browser-scroll-behavior":"auto","eaf-browser-download-path":"~/Downloads","eaf-browser-aria2-proxy-host":"","eaf-browser-aria2-proxy-port":"","eaf-browser-dark-mode":"","eaf-pdf-dark-mode":"","eaf-terminal-dark-mode":"","eaf-terminal-font-size":"13","eaf-mindmap-dark-mode":"","eaf-mindmap-save-path":"~/Documents","eaf-marker-letters":"ASDFHJKLWEOPCNM","eaf-emacs-theme-mode":"dark"}
atomic-chrome-httpd -- listen -- -- Main (network server on local:4001)
httpd -- listen -- -- Main (network server on [127 0 0 1 8081])
ispell 4075 run -- -- Main aspell -a -m -d en --encoding=utf-8 --reverse --sug-mode=ultra --lang=en_US
mirrors.tuna.tsinghua.edu.cn -- open -- -- Main (network connection to mirrors.tuna.tsinghua.edu.cn:80)
mu4e-update 21995 run *mu4e-update* /dev/pts/7 Main /usr/bin/bash -c getmail --rcfile [email protected] --rcfile [email protected]
nrepl-connection -- open *cider-repl elpa/ejc-sql-20200502.36:localhost:44069(clj)* -- Main (network connection to localhost:44069)
nrepl-server 7067 run *nrepl-server elpa/ejc-sql-20200502.36:localhost* /dev/pts/4 Main /usr/bin/bash -c /home/stardiviner/bin/lein update-in :dependencies conj \[criterium\ \"0.4.4\"\] -- update-in :dependencies conj \[io.github.erdos/erdos.assert\ \"0.1.0\"\] -- update-in :dependencies conj \[datawalk\ \"0.1.12\"\] -- update-in :dependencies conj \[com.cemerick/pomegranate\ \"1.1.0\"\] -- update-in :dependencies conj \[nrepl\ \"0.7.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.25.0-alpha1\"\] -- repl :headless :host localhost
pinentry -- listen -- -- Main (network server on /tmp/emacs1000/pinentry)
server -- listen -- -- Main (network server on /run/user/1000/emacs/server)
websocket server on port 64292 -- listen -- -- Main (network server on local:64292)
我在 Org Mode 里面用 org-attach-url
[C-c C-a u] 下载图片的。会不会和这个有关系?多次下载是不是就都加载到内存里面了?
我估计和我开了特别多的buffer有关。打开了很多Org 文件。有不到500个的Org文件打开了。不过没打开 inline image 之类的。
安装了包 memory-usage
(这个显示的信息蛮有用的,谢谢 @seagle0128 )
结果如下:
Garbage collection stats:
((conses 16 8494477 4233363) (symbols 48 121972 106) (strings 32 668372 534583) (string-bytes 1 23625519) (vectors 16 435894) (vector-slots 8 4898168 3413222) (floats 8 95833 15578) (intervals 56 486706 139801) (buffers 1000 640))
=> 130MB (+ 64.6MB dead) in conses
5.58MB (+ 4.97kB dead) in symbols
20.4MB (+ 16.3MB dead) in strings
22.5MB in string-bytes
6.65MB in vectors
37.4MB (+ 26.0MB dead) in vector-slots
749kB (+ 122kB dead) in floats
26.0MB (+ 7.47MB dead) in intervals
625kB in buffers
Total in lisp objects: 364MB (live 249MB, dead 115MB)
Buffer ralloc memory usage:
571 buffers
46.3MB total (1.98MB in gaps)
Size Gap Name
4371395 195107 *info elisp*<3>
4371395 195107 *info elisp*<4>
4371395 195107 *info elisp*<5>
2133327 2000 Org Mode.org
1509747 2000 Novel Books.org
1481564 2000 loaddefs.el
1452828 2000 My Clojure Language Syntax Reference.org
1122157 1934 Learn Programming Plan.org
786831 1999 Softwares.org
780625 2000 My Emacs Lisp Language Syntax Reference.org
727724 2000 Code.org_archive
598992 8432 Code.org
544609 2671 Computer Todos.org
528870 2000 My Chinese Law Database.org
470034 5211 *Packages*
457001 1759 Emacs Packages.org
441063 2000 Clojure.org
422708 2000 org-agenda.el
404939 2000 Programming Projects.org
363698 2000 Arch Linux dotfiles.org
325265 2000 Contacts.org
313265 2000 Open Source.org
307805 2000 My Docker Reference.org
304351 2000 Emacs.org
272766 2000 Internet Censorship.org
270126 2000 Java.org
267928 5620 *Org Agenda(t)*
265382 2000 My PostgreSQL Language Syntax Reference.org
259541 2000 Internet Companies.org
251578 2000 My Emacs Lisp Examples.org
246296 2000 JavaScript.org
214989 2000 Chinese Censorship.org
213848 2000 buffer.c
211303 2000 Things.org
210174 2000 My Clojure Examples.org
196897 2000 Mathematics.org
194763 2000 Beauty.org
193667 2105 *Messages*
190351 2000 Docker.org
186952 1845 Bookmarks.org
185310 2000 浙江尚游网络科技有限公司.org
185211 2000 我的思想手札.org
184763 2000 My Git Usage Reference.org
171044 2000 Cyber Security.org
165254 2000 Algorithm.org
163539 2000 Learning Plan.org
162230 702 Artificial Intelligence.org
161432 2000 Life.org
159132 2000 Agenda Statistics.org
158424 2000 Clojure Packages.org
148814 2000 Internet Privacy.org
148053 2000 How to Learn.org
145578 2000 Agriculture Projects.org
144185 15972 accounts.org.gpg
139022 2000 Words.org
136044 2000 Visual Studio Code.org
134756 2000 Startup.org
133380 2000 Microsoft Windows.org
131534 2000 LISP.org
131534 2000 My ClojureScript Language Syntax Reference.org
129972 2000 My Java Language Syntax Reference.org
129773 2000 Crack.org
128322 2000 Thinking.org
125824 2000 My JavaScript Language Syntax Reference.org
123111 2000 Economy.org
122952 7522 *info*<2>
122952 7522 *info*
122047 2000 PostgresQL.org
121156 2000 Programming.org
121089 2000 Abilix.org
120206 2000 Web Scraping.org
119996 2000 Computer Todos.org_archive
119107 2000 Diary.org
117197 2000 My SQLite Syntax Reference.org
116474 2000 Arduino.org
116139 2000 emacs-application-framework.org
108254 2000 Projects.org_archive
108007 2000 Porn Stories.org
105483 2000 Philosophy.org
105140 2000 Work.org
102402 2000 English.org
100615 2000 Unwritten Rules.org
99845 2000 Sociology.org
95551 2000 Learn Programming Plan.org_archive
93851 2000 ClojureScript.org
93579 2000 Python.org
92928 2000 Creativity.org
92506 1944 道家.org
91336 2000 mu4e.org
89845 2000 SQL.org
88321 2000 Communication.org
86926 2000 Healthcare.org
82309 2000 Machine Learning.org
82154 2000 Imperial Study.org
81730 2000 中国国产电视剧《天道》.org
79943 2000 .NET Core.org
79299 2000 Chinese Economy.org
77640 2000 Poem.org
77179 1510 *Bookmark List*
76365 2000 China.org
76105 2000 Game Theory.org
75959 2000 Overtone.org
75711 2000 Programmer.org
73401 715 Deep Learning.org
71672 2000 Internet.org
70807 1999 Sexology.org
70566 2000 Go.org
69782 2000 ejc-sql.org
67437 2000 Blockchain.org
66564 1934 Daily.org
64960 2000 Science and Technology.org
64548 2000 Data Science.org
64287 2000 My Internet Marketing Manual.org
63570 2000 AJAX.org
62900 2878 *mu4e-headers*
61697 2000 Chinese Government.org
60533 129 R.org
60372 2000 Chinese History.org
59482 2000 Investing and Financing.org
58525 2000 How to Learn Programming Languages.org
58505 2000 My Startup Manual.org
57499 2000 Learning.org
57099 2000 Genetics.org
56669 1287 Debug Emacs and Emacs Lisp.org
56582 2000 My Thought Manuals.org
56087 2000 Chinese Law.org
52817 2000 Digital Currency.org
52223 2000 Interpersonal Network.org
51964 2000 Samba.org
51951 2000 Programming Languages.org
50981 2000 Software Development.org
50644 2000 Jupyter.org
50426 2000 Taobao Shop Management.org
49924 2000 Politics.org
48798 2000 Entertainment.org
48457 2000 World Grid Information.org
48110 1944 Self Enhancement.org
47886 2000 Working with log files in Emacs.org
47275 2000 Mind Growth.org
47089 2000 Poems Collection.org
46950 2000 Quantitative Trading.org
46716 2000 NoSQL.org
46650 2000 Psychology.org
46137 2000 My Liked Love.org
45852 2000 pdf-tools.org
45564 2000 Writing Projects.org
45319 1933 Porn Novel Books.org
45186 2000 OpenCV.org
44689 2000 Thought.org
43931 2000 Kubernetes.org
42937 2000 Python Packages.org
42794 2000 Mental Secret.org
42082 2000 API.org
41419 2000 Programming Projects.org_archive
40795 2000 Strategy.org
40754 2000 Big Data.org
40613 2000 Hardware Projects.org
39019 2000 Neo4j.org
38289 1517 lsp-java.org
37693 2000 Business Projects.org
37658 2000 Social Intercourse.org
37352 1965 Pornography.org
37351 2000 Fortune.org
37247 2000 My Chinese Government Administration Manual.org
37132 2000 My Crack Manual.org
37011 2000 Kung Fu.org
36722 2000 DevOps.org
35890 2000 Qt.org
35198 1939 Data Analysis.org
35057 2000 *mm*-900519
35050 2000 C.org
35018 2000 Luminus.org
33304 2000 Democracy.org
33165 2000 Artificial Neural Network.org
32854 2000 ejc-sql.el
32706 2000 Business.org
31197 2000 E-Commerce.org
30912 2000 A Manual to Understanding Life.org
30743 2000 My Kung Fu Manual.org
30521 2000 elpy.org
30418 2000 HTTP.org
30410 2000 Raspberry Pi.org
30371 2000 Agriculture Projects.org_archive
30276 1962 Sexual Intercourse.org
30077 2000 Education.org
29731 1871 Stock.org
29693 2000 company-box.org
29485 2000 C++.org
29447 2000 Travel Plan.org
29185 2000 C#.org
28966 2000 REST.org
28917 2000 Cybernetics.org
28860 2000 Dired.org
28621 1930 *Org Agenda(a)*
28455 2000 Brain Science.org
28114 2000 pip.org
27547 2000 shadow-cljs.org
27003 2000 Android App Development.org
26976 2000 macOS.org
26619 2000 Management.org
26614 2000 Porn.org
26371 2000 Love.org
26224 2000 My Health.org
26180 2000 Java Packages.org
26167 5890 taobao_images
25968 2000 儒家.org
25966 2000 Web.org
25926 2000 My Communication Skills Manual.org
25835 2000 TensorFlow.org
25803 2000 Data Structure.org
25761 2000 My Life Experience.org
25683 1882 Natural Language Processing.org
25593 2000 Sale.org
25262 2000 Male and Female.org
25098 2000 How to Read Code.org
24806 2000 Law.org
24541 2000 clj.org
24466 2000 Medicine.org
24464 2000 Social Engineering.org
24464 2000 Marketing.org
24206 2000 诸子百家.org
23767 92 *Compile-Log*
23540 2000 Censorship.org
23322 2000 Time Management.org
23289 2000 Concurrency and Parallel.org
22891 2000 Database.org
22788 2000 My SQL Language Syntax Reference.org
22573 2000 clojure.java-time.org
22484 2000 Oz.org
22389 2000 Debugger for Chrome.org
22176 2000 *mm*
22090 2000 How to Programming.org
22055 2000 org-brain.org
21711 2000 House Tasks.org
21505 2000 Company.org
21026 2000 Sex Knowledge.org
20719 2000 Ideas HowTo.org
20525 2000 My Chinese Government Communication Records.org
20376 2000 Data Visualization.org
19930 2000 Distributed Systems.org
19850 2000 Retail.org
19845 2000 Graph Model.org
19710 2007 Erotic.org
19565 2000 clj-new.org
19110 2000 Adobe Photoshop.org
18496 2000 My Chinese Law Usage Manual.org
18138 2000 Internet Marketing.org
17838 2000 Physics.org
17652 2000 Biology.org
17590 1908 Wiki.org
17348 2000 Graph Theory.org
17258 2000 Computer Vision.org
16974 2000 City Planning and Construction.org
16909 2000 opencv-python.org
16818 2000 Commercial Science.org
16743 2000 Site Reliability Engineer.org
16635 2000 Implementations.org
16258 2000 Rich and Poor.org
16235 2000 Copyright.org
15968 2000 org-ql.org
15864 699 房中术.org
15863 2013 Female.org
15569 2000 Hack.org
15568 2000 JavaScript Packages.org
15528 2000 Human.org
15405 2000 Writing.org
15318 2000 org-noter.org
14902 2000 Hacker.org
14461 2000 ClojureScript Packages.org
14413 2000 Leadership.org
14074 2000 Organization Projects.org
14074 2000 Evolutionism.org
13892 2000 *mm*-368986
13624 2000 My Data Science Reference.org
13293 2000 clomacs.org
12756 2000 我的自媒体.org
12742 2000 README.org<kiwix.el>
12734 2000 Myself.org
12556 2000 Software Architecture.org
12446 2000 connect.clj
12432 2000 Complex Systems.org
12357 2000 init.el
12315 2000 Emacs Lisp.org
12168 2000 Sex Projects.org
12163 2000 Immortality.org
12033 2000 Realty.org
11895 2000 output.clj
11656 2000 Tasks.org_archive
11474 1258 *lsp-log*
11374 2000 Morality.org
11070 2000 My Arduino Syntax Reference.org
11002 3958 Finance.org
10955 2000 Organization.org
10864 2000 Skin.org
10773 2000 Family Tasks.org_archive
10584 2000 Projects.org
10481 1644 People Assessment.org
10262 2000 My Algorithms Reference.org
10148 2000 Linguistics.org
10138 2000 Android.org
9824 2000 People Management.org
9821 2000 Social Network.org
9812 2000 Society.org
9689 2000 Responsive Web Design.org
9499 2000 Plans.org
9430 1799 Legerdemain.org
9424 2000 Programming Mathematics.org
9401 2000 init-company-mode.el
9371 2000 init-SQL.el
9261 2000 local accounts.org
9188 1987 UserScript.org
8977 2000 今日头条 自媒体平台.org
8867 2000 Literature.org
8840 2000 Novels.org
8830 2000 Dictatorship.org
8423 2000 Statistics.org
8317 2000 My Poems Collection.org
8152 2000 Porn Stars Reference.org
8092 1897 Mental Hijacking.org
7981 2000 History.org
7831 2000 Government.org
7480 2000 Memory.org
7397 2000 Religion.org
7300 2000 Read Books.org
7300 2000 deps.edn
7250 2000 Hardware.org
7058 2000 World Projects.org
6933 2000 R Packages.org
6896 2000 Web Design.org
6613 2000 amread-mode.el
6583 2000 vega-view.org
6568 2000 WeChat Mini Program.org
6557 2000 Porn Stars.org
6381 919 Chinese Erotic Literature.org
6379 2000 Live.org
6035 2000 neo4j-clj.org
6031 2000 Economy of China.org
5963 2000 Electronics.org
5928 506 book-page-theme.org
5916 2000 Image Processing.org
5909 2000 Building Projects.org
5907 2000 The We Media Operation Manual.org
5860 2000 Family Tasks.org
5857 2000 Cryptocurrency.org
5845 2000 Habit.org
5824 2000 skyscraper.org
5726 2000 Knowledge.org
5713 2000 Matlab.org
5565 2000 Communication Studies.org
5342 2000 Digital Currency Electronic Payment.org
5298 2000 Automation & Robotics.org
5255 2000 Computer Technology.org
5076 2000 Chinese Culture.org
5074 2000 Aesthetics.org
4813 2000 *mm*-728535
4810 2000 Anti Internet Censorship.org
4795 1321 *Org tags*
4697 2000 org-kiwix.el
4648 2000 Growth Hacker.org
4570 2000 Success.org
4559 2000 Public Opinion.org
4468 2000 Art.org
4459 2000 Financing.org
4423 2000 Movie.org
4415 2000 README.org<brantou>
4336 2000 lib.clj
4268 2000 config
4218 2000 *eaf*
4197 2000 org-roam.org
4166 2000 Chinese Medicine.org
4117 2000 Popularization of Science.org
4088 2000 Travel.org
4082 2000 Conduct in Society.org
4025 2000 tortuga.org
4007 2000 Presto.org
3930 2000 Society Projects.org
3930 2000 Hardware Programming.org
3922 2000 add-log.org
3874 2000 Capitalism.org
3793 2000 Anthropology.org
3789 2000 Coding.org
3782 2000 Anniversary.org
3772 2000 Ubuntu.org
3755 2000 Social Public Security.org
3655 2000 with-proxy.org
3636 2000 Write Code.org
3605 1922 Visual Studio Code Extensions.org
3429 2000 Culture Projects.org
3357 1961 Chinese.org
3308 2000 Family.org
3286 2000 *mm*-268356
3281 2000 Comic.org
3152 2000 ACG.org
3115 2000 Bioinformatics.org
3097 2000 JVM.org
2917 2000 Systems Science.org
2914 2000 How to report Bug.org
2881 2000 Entertainment.org_archive
2822 2000 Cooking.org
2811 2000 Female Projects.org
2760 2000 classpath.clj
2753 2000 README.org<subscribe>
2699 2000 Culture.org
2686 2000 High-frequency Trading.org
2669 2000 project.clj
2633 2000 pgAdmin.org
2621 2000 *mm*-956437
2576 2000 cache.clj
2543 2000 Abilix.org_archive
2535 2460 magit: org-mode
2529 2000 淘宝.org
2454 2000 Policy.org
2445 1994 *cider-repl elpa/ejc-sql-20200502.36:localhost:44069(clj)*
2430 2000 init-prog-lang-java.el
2430 2000 neo4clj.org
2423 2000 Immortality Projects.org
2314 2000 init-org-view.el
2260 2000 *mm*-149603
2254 2000 Finance Projects.org
2139 2000 keywords.clj
2088 1976 *org-src-fontification:html-mode*
2033 2000 wechat-clj.org
1991 2000 Technology Projects.org
1965 2000 My Thinking Manual.org
1889 2000 2014-08-14-15:06.org
1885 2000 INDEX.org
1867 2000 Self Management.org
1850 2000 Home Assistant.org
1737 2000 Chaos Engineering.org
1678 2000 jackdaw.org
1671 2000 Read Code.org
1659 2000 init-emacs-theme.el
1647 2000 Polity.org
1638 2000 WeChat Open Platform.org
1540 2000 FastAPI.org
1529 2000 Manufacturing.org
1471 2000 *mm*-258854
1374 2000 *mm*-781425
1364 2000 *mm*-250041
1340 2000 My Internet Popularize Manual.org
1331 2000 README.org<amread-mode>
1313 2000 excel-clj.org
1225 2000 Computational Fluid Dynamics.org
1186 2000 China Mythology.org
1160 1930 Visual Studio.org
1148 882 *mu4e-main*
1119 2000 Orgasm.org
1114 2000 Human Projects.org
1094 3596 Erotic Literature.org
1085 2000 Product Projects.org
1042 2000 Kite.org
1022 1941 国学.org
990 2000 install.sh
973 2000 Programmable Music.org
923 2000 *mm*-445307
896 1377 *org-src-fontification:js-mode*
886 1730 *Agenda Commands*
836 2000 hara.org
830 2000 Build Open Community Project.org
817 1204 *Org todo*
811 2000 My Neo4j Graph Database Reference.org
807 1216 *Help*
806 2000 Health of Human Body.org
801 2000 Like.org
792 2000 C++ Packages.org
732 2192 magit-diff: emacs<stardiviner>
730 2000 PostgreSQL extensions.org
723 2000 *mm*-355184
688 1573 *Buffer Details*
683 2000 Architecture.org
650 2000 Intestine.org
637 2000 Things.org_archive
624 2000 My Set Up Shop Manual.org
623 2000 My Body Reaction Manual.org
615 2000 Male Projects.org
581 2000 *mm*-369450
572 1645 UserScript List.org
572 2000 README.md
560 2000 Tasks.org
555 2000 We Media.org
545 2000 Mini Program.org
534 2000 Countries Literature.org
530 2192 magit-diff: emacs<dotfiles>
529 2000 Mechanics.org
522 1503 *Calendar*
514 2000 My Internet Marketing Examples.org
494 2000 OpenCL.org
472 2000 Business Projects.org_archive
469 1575 magit-process: org-mode
463 2011 *http mirrors.tuna.tsinghua.edu.cn:80*-523578
463 2011 *http mirrors.tuna.tsinghua.edu.cn:80*
463 2011 *http mirrors.tuna.tsinghua.edu.cn:80*-445185
463 2011 *http mirrors.tuna.tsinghua.edu.cn:80*-593054
462 1571 *rg*
461 3362 *which-key*
442 2000 My Health.org_archive
437 1585 magit-process: emacs
433 2000 rx.org
427 2000 Clothes Projects.org
426 2000 The We Media Incoming Manual.org
426 1999 *org-src-fontification:fundamental-mode*
415 1609 *GNU Emacs*
407 5253 *code-converting-work*
400 2000 Chinese Literature.org
389 2000 Countries Culture.org
388 2000 sql-postgresql
370 2000 orgtbl-aggregate-autoloads.el
366 2000 with-shell-interpreter.org
343 2830 *org-src-fontification:org-mode*
334 2000 Home.org
320 1701 *org-src-fontification:python-mode*
311 2000 My Linux Manual.org
311 1842 *nrepl-server elpa/ejc-sql-20200502.36:localhost*
290 2000 Mythology.org
289 2000 PostGIS.org
275 2000 Economy of Countries.org
256 2000 Industry Robotics.org
251 2000 Internet Popularize.org
248 2000 Fluid Mechanics.org
210 2000 psql.org
202 2000 *mm-uu*-653288
186 2000 Set Up Shop.org
177 1852 *Fd*
174 2000 The We Media Platforms Manual.org
163 2000 *mu4e-update*
160 1999 *org-src-fontification:java-mode*
159 2000 *mm-uu*
140 2000 My Government Policy Usage Manual.org
135 2377 *org-src-fontification:json-mode*
125 1972 *org-src-fontification:sql-mode*
117 1999 *org-src-fontification:csharp-mode*
107 2000 Creativity Methodology.org
107 1932 *http raw.githubusercontent.com:443*
107 1932 *http raw.githubusercontent.com:443*-383861
105 2001 *org-src-fontification:conf-mode*
91 1999 *org-src-fontification:css-mode*
85 8130 *helm org inbuffer*
65 1990 *autoload*
62 2000 *mm-uu*-101523
51 2000 *temp*-532994
42 1999 *org-src-fontification:R-mode*
41 1993 *canonical address*
41 1993 *extract address components*
35 2000 *httpd*
32 1990 *org-src-fontification:sh-mode*
31 2000 *scratch*
30 2350 *org-src-fontification:ruby-mode*
29 7639 *org-src-fontification:emacs-lisp-mode*
25 2202 *org-src-fontification:clojure-mode*
18 2 *mu4e-loading*
17 236694 *code-conversion-work*
17 3 *temp*
13 2008 *gnus work*
8 12 *temp*-576069
2 18 *org-src-fontification:s-mode*
1 6130 *Echo Area 1*
0 5396 *Minibuf-1*
0 20 PostgreSQL即学即用中文第2版.pdf
0 2025 *Minibuf-2*
0 20 *Minibuf-0*
0 2050 *Echo Area 0*
0 18384 index.org
0 20 *eww*
0 20 *cider-context-buffer*
0 76379 *nrepl-decoding*
0 20 *Shell Command Output*
0 20 *Org-Babel Error*
0 20 *mu4e-proc*
0 20 *appease-gnus*
0 20 *server*
0 6410 *Backtrace*
下面的这个 dead
是指没有引用了,应该被GC的内存部分么?看起来还挺多的。
=> 130MB (+ 64.6MB dead) in conses
5.58MB (+ 4.97kB dead) in symbols
20.4MB (+ 16.3MB dead) in strings
22.5MB in string-bytes
6.65MB in vectors
37.4MB (+ 26.0MB dead) in vector-slots
749kB (+ 122kB dead) in floats
26.0MB (+ 7.47MB dead) in intervals
625kB in buffers
我吧 session 关掉( desktop-save-mode
)后,所有的Org文件都不打开。
但是打开Emacs后,内存还是很高。应该和我记载太多的包有关系。虽然我 use-package :defer t
了很多。
两个Emacs进程的对比。
我试试benchmark,找出启动过程中的大项目。
用 benchmark-init
测试Emacs启动的结果:
#+begin_example
init-org-agenda require 10912 10962
pdf-view require 2985 3166
init-org-babel require 1970 2070
init-prog-lang-python require 1043 1368
yasnippet require 780 792
ox-pandoc require 442 1100
init-emacs-font require 302 302
init-company-mode require 291 620
eaf require 290 713
init-emacs-encrypt require 277 277
ssh-agency require 235 235
init-emacs-bookmark require 209 297
auto-complete require 208 208
init-org-publish require 184 231
default load 177 177
ivy require 174 299
eaf-interleave require 167 301
init-prog-project require 161 535
init-emacs-appearance require 149 149
tramp require 146 479
language-detection require 122 122
eaf-mindmap require 122 122
init-org-todo require 115 179
init-prog-lang-javascript require 113 148
init-emacs-minibuffer require 112 301
cider require 111 1572
init-RESTful require 103 103
init-emacs-window require 102 119
init-prog-vcs-git require 101 101
flycheck require 98 210
init-dired require 96 226
init-prog-vcs-changelog require 90 143
init-tool-browser require 90 157
init-SSH require 90 362
init-emacs-pdf require 90 3492
#+end_example
对于一个纯文本编辑器900+ 或 400+ MB 明显偏高,我这 Emacs 启动了超过一天、平常使用,内存 200+ MB。
你的列表占空间看起来过大,我的大概 13 MB。
还有子进程的内存应该不会算到 Emacs 头上。
这是我环境中的情况(大概使用一天,50个buffer左右):
Garbage collection stats:
((conses 16 1061858 394613) (symbols 48 69668 34) (strings 32 277154 74696) (string-bytes 1 8856036) (vectors 16 126969) (vector-slots 8 2471353 235848) (floats 8 3919 4961) (intervals 56 17973 3622) (buffers 992 66))
=> 16.2MB (+ 6.02MB dead) in conses
3.19MB (+ 1.59kB dead) in symbols
8.46MB (+ 2.28MB dead) in strings
8.45MB in string-bytes
1.94MB in vectors
18.9MB (+ 1.80MB dead) in vector-slots
30.6kB (+ 38.8kB dead) in floats
983kB (+ 198kB dead) in intervals
63.9kB in buffers
Total in lisp objects: 68.5MB (live 58.1MB, dead 10.3MB)
你的环境中org启动消耗了大量资源,这个需要查下。
是的,有些 Org Mode 文件是很大。而且可能由于Org 启用的一些占用资源的选项。进一步增加了内存。我review一下我自己的Org设置的那些选项。找找可能有关的。谢谢
有啥命令释放这些dead内存?
发现有一些Linux下的profiling 工具,比如 sysprof
,我用了下,但是看不懂。有谁看得懂的,帮忙看下,非常感谢。
我上传了记录文件
链接: https://pan.baidu.com/s/1ZI4TBHgbbn7TOyFgfcOA-A 提取码: zwkf
你发的图片只是函数调用次数上的采样,需要针对内存的。 linux 下 profile 工具比较多,推荐使用 gperf
这个