all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dave Love <d.love@dl.ac.uk>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: the ...-unload-hook convention doesn't work
Date: Sat, 17 Jan 2004 00:21:57 +0000	[thread overview]
Message-ID: <rzq65fbfmqi.fsf@albion.dl.ac.uk> (raw)
In-Reply-To: ilur7y08lda.fsf@latte.josefsson.org

Simon Josefsson <jas@extundo.com> writes:

> Which feature is this?

gnus-nocem (though it's probably not be doing me much good anyway
without reading usenet).

> Any hints on finding leaking code, in general?

In that case I guess it fails to purge a hash table, which I couldn't
easily follow.

> I have been using the following to print out large symbols:
>
> (mapatoms (lambda (sym)
> 	    (let ((len (ignore-errors (length (symbol-value sym)))))
> 	      (if (and len (> len 500) (not (= len 507904)))
> 		  (insert (format "%s: %s\n" sym len))))))
>
> But it doesn't seem to work well.

You need dependency info tracing all slots from obarrays to start
with, and then you won't account for data kept live through C code, at
least (e.g. text properties).

> I have been getting complaints
> about exhausting the memory from Emacs without that code generating
> anything interesting.  My machine has 1 GB RAM, and emacs is typically
> around 100MB but can grow to 300MB or so when I do something major in
> Gnus.

The message is probably misleading in that case -- see all its uses in
alloc.c (?).

The limit on what a Lisp pointer can address is 128MB (or 256 -- I
can't remember) on a 32-bit system.  I added a comment to that effect
somewhere.  The actual data in strings, for instance, aren't
necessarily in the same address space, but as far as I remember,
probably contribute to that limit because they're malloced from the
same region of (end of) the machine's address space (whereas mmapped
space is at the other end, at least under Linux).  See (probably) the
same comment as above.

It's made worse because pages allocated in the big bag don't get freed
at least until they're completely emptied by GC -- see unused conses
&c in the GC statistics.

(A different sort of leak -- buffer space -- can occur on systems like
Solaris which don't use the relocating allocator, and/or the mmap
mechanism -- I forget.  I don't remember whether the buffer space is
in the Lisp pointer range in that case or not.  I thought rms vetoed
the solution, but it's still in the version of TODO I have).

> Essentially: how do I find out what is taking up all memory in Emacs?
> Perhaps a package that report these things would be handy.

You can't, without serious work on the internals.

Replacing the GC, and perhaps the object representation, per TODO
could/would address all these issues to a greater or lesser extent.  I
assume there's a policy against that now since the old one is being
tinkered with.  Implementing the TODO item on `long long' would remove
the addressing limitation at the expense of larger data, at least
using GCC.

  parent reply	other threads:[~2004-01-17  0:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-05 18:24 the ...-unload-hook convention doesn't work Luc Teirlinck
2004-01-06 14:33 ` Dave Love
2004-01-07 15:05   ` Richard Stallman
2004-01-09 14:39     ` Dave Love
2004-01-09 17:08       ` Luc Teirlinck
2004-01-11 19:37         ` Richard Stallman
2004-01-12 19:35           ` Kevin Rodgers
2004-01-16  0:23           ` Dave Love
     [not found]           ` <mailman.744.1074223463.928.bug-gnu-emacs@gnu.org>
2004-01-16  6:21             ` Simon Josefsson
2004-01-16 19:54               ` Richard Stallman
2004-01-17  2:22                 ` Simon Josefsson
2004-01-17  0:21               ` Dave Love [this message]
2004-01-12 15:23         ` Dave Love
2004-01-11 19:36       ` Richard Stallman
2004-01-16  0:18         ` Dave Love
2004-01-16 19:54           ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2004-01-05 15:01 Dave Love

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=rzq65fbfmqi.fsf@albion.dl.ac.uk \
    --to=d.love@dl.ac.uk \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.