help-gnu-emacs
[Top][All Lists]
Advanced

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

defadvice on garbage-collect doesnt work?


From: joakim
Subject: defadvice on garbage-collect doesnt work?
Date: Tue, 13 Mar 2007 22:37:53 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux)

I would like to make a little memory meter for emacs on the mode line.

I would like to use the information returned by (garbage-collect) but
it doesnt seem right to do a garbage collect everytime the modeline is
displayed, therefore i would like to store the values calculated by
the last gc in a variable:

in ielm:

(defadvice garbage-collect (around
garbage-collect-advice-store-values) (setq last-gc-value ad-do-it))
(ad-activate 'garbage-collect)

(garbage-collect)
last-gc-value

last-gc-value shows the right values, same as returned by
(garbage-collect). However, when I leave emacs running for a couple of
hours, last-gc-value doesnt change. I interpret this as meaning my
defadvice is ignored when emacs gc:s automatically, but not when
called interacvtively.

Any hints how to achieve this? BTW the use-case I had in mind for the
memory meter was to see what kinds of operations gobbles up memory. I
have trouble with emacs growing slowly over a fortnight until its so
huge it crashes. 


-- 
Joakim Verona





reply via email to

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