emacs-devel
[Top][All Lists]
Advanced

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

Re: how do you track down emacs memory leaks?


From: Ami Fischman
Subject: Re: how do you track down emacs memory leaks?
Date: Sat, 20 Dec 2008 08:27:49 -0800

This leak ended up being caused by the bug I reported last night
(mode-line-eol-desc-cache being grown indefinitely).  Gnus was not the
cause but rather the trigger, since it visits so many files (using
nnml backend) and visiting files was a prime way to tickle the
mode-line-eol-desc-cache bug.

Since this thread was about debugging methods, I figured I'd add to it
the way that I finally found the culprit:

(defun ami-big-var-p (sym)
  (when (and (boundp sym)
             (> (length (prin1-to-string (symbol-value sym))) (* 1024 1024)))
    t))
(mapatoms '(lambda (sym)
             (when (ami-big-var-p sym)
               (message (symbol-name sym)))))

This led me to the insanely large variable and from there it was just
a matter of tracking down its construction.

Cheers,
-a

On Tue, Nov 4, 2008 at 8:59 AM, Chong Yidong <address@hidden> wrote:
> "Ami Fischman" <address@hidden> writes:
>
>>> Does this problem only show up when you use gnus?
>>
>> Yes.
>>
>>> Could you try keeping
>>> another Emacs session around for other non-gnus usage, and see if it
>>> leaks memory?
>>
>> I have and it doesn't.  At least not nearly at the rate that the
>> gnus-using session does.
>>
>> I updated my version of gnus from ngnus-0.10 to CVS head yesterday and
>> the leak seems to have slowed down significantly - only about 8MB
>> overnight.  So I suspect some trigger has been coincidentally
>> suppressed, but it seems that no elisp code should be able to cause
>> emacs to grow in memory usage disproportional to the numbers reported
>> by memory-usage, so there is still probably a lurking leak in emacs.
>>
>> Do you have any tools/techniques you use to track down C-level leaks?
>
> I'm afraid not.  Maybe someone else on this list can suggest something.
>
> One possibility is to try and write a simple test case that demonstrates
> the leak.  For instance, a short Elisp program that keeps creating and
> killing network processes.  If such a program causes memory to increase,
> that would demonstrate that the memory leak is occurring in the Emacs
> network process code.
>




reply via email to

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