emacs-devel
[Top][All Lists]
Advanced

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

Re: Memory again


From: Stefan Monnier
Subject: Re: Memory again
Date: Tue, 06 Dec 2011 08:29:06 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux)

>> I still believe this is what's happening for me on Linux 3.x and
>> Darwin 10.7.x when I kill a buffer and the claimed memory is not
>> given back to the kernel.

> I tried with 1M of #warnings, and (buffer-size *compilation*) was 58M - but
> RSS grows to 2250M. During compilation, strace shows an excessive usage both
[...]
> But even after GC, RSS is 2192M. Oops.

While RSS is a useful measure for performance debugging, here it gives
us "vague" numbers only since returning 100MB to the kernel may have no
effect on the RSS if that memory was not in RAM.

Still, the point in any case is that if the buffer is 60MB, then killing
it will return those 60MB to the kernel, but it won't return to the
kernel the memory allocated for Lisp objects such as interval nodes
(used for text-properties), cons cells, strings, etc...
So of your 2250MB, only the 60MB of the buffer text will be recovered by
the kernel (well, potentially more, depending on how fragmented the Lisp
objects are, but in practice these things seems to stick around).
The rest will stay property of Emacs.  This doesn't mean it's wasted:

Emacs should be perfectly able to reuse it next time it needs memory for
cons cells, strings, interval nodes, ...
E.g. re-running the same compilation should not significantly grow the
Emacs process (other than the extra 60MB, of course).


        Stefan



reply via email to

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