Questions tagged [garbage-collect]

8 questions
21
votes
2 answers

Is there any downside to setting `gc-cons-threshold` very high and collecting garbage when idle?

I added the following two lines to the top of my init.el: (setq gc-cons-threshold (eval-when-compile (* 1024 1024 1024))) (run-with-idle-timer 2 t (lambda () (garbage-collect))) That means that instead of collecting garbage every 800kb of…
Nova
  • 1,059
  • 9
  • 21
5
votes
1 answer

Why does a let-bound huge list survive garbage collection after the let form?

Note that the following original test is errorneous and has been superseded by the EDITED version below. (progn (message "Before: %S" (memory-use-counts)) (let ((x (make-list 100000000 0))) (message "Use: %S" (memory-use-counts))) (message…
Tobias
  • 32,569
  • 1
  • 34
  • 75
3
votes
1 answer

Garbage collection: Memory leak?

Let's roll: $ emacs -Q M-x shell $ while true; do echo XXXXXXXX; done Depending on how much RAM you have in total, wait for some reasonable amount. For instance, I'm typically waiting until the shell buffer is around 5M lines and the corresponding…
Alexander Shukaev
  • 1,125
  • 10
  • 22
2
votes
0 answers

Do markers need to be explicitly cleared to be garbage collected?

When creating markers, should code that may fail (a user defined function for example) clean-up after it's self? So for example, new markers are created, the function of unknown origin is called, on error, set all markers positions to nil so they…
ideasman42
  • 8,375
  • 1
  • 28
  • 105
2
votes
0 answers

Freeing cons cells after use in emacs-lisp?

Is there a way in emacs-lisp to return cells to the free list once I do not use them any more? This would be useful in code where I build huge lists temporarily and can free them without waiting for garbage collector to do it. This exists in other…
phs
  • 1,095
  • 6
  • 13
1
vote
1 answer

How does emacs mark the stack for GC

Since I tried creating my own Lisp interpreter (just for learning purposes, as I knew it wouldn't get too far), I have read and tried to understand the internal workings of the Elisp interpreter and always wondered how Emacs does its garbage…
user18068
0
votes
2 answers

Reducing Emacs Startup Time

I read that changing the default garbage collector settings is not recommended https://lists.gnu.org/archive/html/help-gnu-emacs/2007-06/msg00243.html however I noticed it can make an impact on the startup speed. I would like to prevent garbage…
Zoli
  • 381
  • 1
  • 7
0
votes
1 answer

How to define a singe weak reference in elisp?

Hash tables in elisp supports weak references, however weak references may be useful without the need to use a hash. How can a weak reference to an object be defined without having to use a hash-table containing one item?
ideasman42
  • 8,375
  • 1
  • 28
  • 105