From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: How to see where emacs memory goes to Date: Wed, 29 Jun 2005 12:37:15 -0400 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1120063983 15195 80.91.229.2 (29 Jun 2005 16:53:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 29 Jun 2005 16:53:03 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 29 18:53:03 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DnfnS-0005GJ-3m for ged-emacs-devel@m.gmane.org; Wed, 29 Jun 2005 18:52:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DnfvW-0006B4-WD for ged-emacs-devel@m.gmane.org; Wed, 29 Jun 2005 13:00:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DnfvA-0006Al-Vj for emacs-devel@gnu.org; Wed, 29 Jun 2005 13:00:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dnfr6-0004qU-CD for emacs-devel@gnu.org; Wed, 29 Jun 2005 12:56:14 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dnfr3-0004YA-2o for emacs-devel@gnu.org; Wed, 29 Jun 2005 12:56:05 -0400 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dnfdb-0000BN-Cs for emacs-devel@gnu.org; Wed, 29 Jun 2005 12:42:11 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 6C34A2CF416; Wed, 29 Jun 2005 12:37:20 -0400 (EDT) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 5699E4AC00F; Wed, 29 Jun 2005 12:37:15 -0400 (EDT) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id 44BB2E6C19; Wed, 29 Jun 2005 12:37:15 -0400 (EDT) Original-To: Joakim Verona In-Reply-To: (Joakim Verona's message of "Wed, 29 Jun 2005 12:06:16 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-4.846, requis 5, autolearn=not spam, AWL 0.05, BAYES_00 -4.90) X-MailScanner-From: monnier@iro.umontreal.ca X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:39896 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:39896 > 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