* defadvice on garbage-collect doesnt work?
@ 2007-03-13 21:37 joakim
0 siblings, 0 replies; 5+ messages in thread
From: joakim @ 2007-03-13 21:37 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: defadvice on garbage-collect doesnt work?
[not found] <mailman.900.1173821943.7795.help-gnu-emacs@gnu.org>
@ 2007-03-14 0:57 ` John Paul Wallington
2007-03-14 7:08 ` Tim X
0 siblings, 1 reply; 5+ messages in thread
From: John Paul Wallington @ 2007-03-14 0:57 UTC (permalink / raw)
To: help-gnu-emacs
joakim@verona.se writes:
> 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:
How about sticking something to collect information on `post-gc-hook',
the hook run after garbage collection has finished ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: defadvice on garbage-collect doesnt work?
2007-03-14 0:57 ` defadvice on garbage-collect doesnt work? John Paul Wallington
@ 2007-03-14 7:08 ` Tim X
2007-03-14 23:45 ` Oliver Scholz
2007-03-14 23:51 ` joakim
0 siblings, 2 replies; 5+ messages in thread
From: Tim X @ 2007-03-14 7:08 UTC (permalink / raw)
To: help-gnu-emacs
jpw@pobox.com (John Paul Wallington) writes:
> joakim@verona.se writes:
>
>> 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:
>
> How about sticking something to collect information on `post-gc-hook',
> the hook run after garbage collection has finished ?
I suspect this would be a better approach. While defadvice is a really great
feature, I've found you can have some issues with it when trying to use it on
very low level functions - mainly those which are based in C source.
Tim
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: defadvice on garbage-collect doesnt work?
2007-03-14 7:08 ` Tim X
@ 2007-03-14 23:45 ` Oliver Scholz
2007-03-14 23:51 ` joakim
1 sibling, 0 replies; 5+ messages in thread
From: Oliver Scholz @ 2007-03-14 23:45 UTC (permalink / raw)
To: help-gnu-emacs
Tim X <timx@nospam.dev.null> writes:
[...]
> I suspect this would be a better approach. While defadvice is a really great
> feature, I've found you can have some issues with it when trying to use it on
> very low level functions - mainly those which are based in C source.
Defadvices have no effect on built-in functions iff they are called
from C code.
Oliver
--
25 Ventôse an 215 de la Révolution
Liberté, Egalité, Fraternité!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: defadvice on garbage-collect doesnt work?
2007-03-14 7:08 ` Tim X
2007-03-14 23:45 ` Oliver Scholz
@ 2007-03-14 23:51 ` joakim
1 sibling, 0 replies; 5+ messages in thread
From: joakim @ 2007-03-14 23:51 UTC (permalink / raw)
To: help-gnu-emacs
Tim X <timx@nospam.dev.null> writes:
> jpw@pobox.com (John Paul Wallington) writes:
>
>> joakim@verona.se writes:
>>
>>> 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:
>>
>> How about sticking something to collect information on `post-gc-hook',
>> the hook run after garbage collection has finished ?
That seems nice, but the hook runs after the gc, right? So how can I
acess the returnvalue of the gc from the hook?
> I suspect this would be a better approach. While defadvice is a really great
> feature, I've found you can have some issues with it when trying to use it on
> very low level functions - mainly those which are based in C source.
>
> Tim
>
> --
> tcross (at) rapttech dot com dot au
--
Joakim Verona
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-03-14 23:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.900.1173821943.7795.help-gnu-emacs@gnu.org>
2007-03-14 0:57 ` defadvice on garbage-collect doesnt work? John Paul Wallington
2007-03-14 7:08 ` Tim X
2007-03-14 23:45 ` Oliver Scholz
2007-03-14 23:51 ` joakim
2007-03-13 21:37 joakim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).