[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to see where emacs memory goes to
From: |
Stefan Monnier |
Subject: |
Re: How to see where emacs memory goes to |
Date: |
Wed, 29 Jun 2005 12:37:15 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> My emacs currently consumes 256Mb virtual, and 125Mb resident.
> Its also fairly slow. This happens a lot with my usage pattern.
> Im trying to get a feel for where the memory consumption and slowness
> occur, and Im looking for techniques. Any hints would be apreciated.
> I currently look at these things:
> - m-x garbage-collect to get a baseline
> - how large the buffers are, including "hidden" ones
> - looking at the number of overlays in certain buffers.
> None of these factors seem to come even close to the numbers I get.
You can google for memory-usage.el which basially analyses the output of
garbage-collect and a few more things to give you some info, but it's
probably not going to help you much (it doesn't give you much more info
than garbage-collect, it's just more readable).
I think it would be helpful to try and come up with some better way to track
down such problems, but it's a difficult subject. One way I can think of is
that in alloc.c we could change mark_object to keep a running count of
the amount of live-memory marked. Then we could provide a command like
(memory-footprint &rest OBJECTS) which would return the amount of live
memory that would be dead if it weren't for OBJECTS. It could be
implemented as follows:
- set the mark bit on all OBJECTS
- go through the complete normal mark phase
- set live_memory_count back to 0 and clear the mark bit on OBJECTS
- call mark_object on all OBJECTS
- finish the GC by calling ther sweep phase
- return live_memory_count.
> Currently it seems ERC is causing a lot of the slowness, if not the
> memory consumption.
Try to kill buffers one by one, and watch how the memory-usage change with
each kill.
Stefan