unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark Seaborn <mseaborn@onetel.com>
Cc: romain@orebokech.com
Subject: Re: "/lib/ld-linux.so.2 /usr/bin/emacs" fails: "Memory exhausted"
Date: Mon, 14 Nov 2005 13:38:19 +0000 (GMT)	[thread overview]
Message-ID: <20051114.133819.846939628.mrs@localhost> (raw)
In-Reply-To: <87iruyhhms.fsf@pacem.orebokech.com>

Romain Francoise <romain@orebokech.com> wrote:

> Mark Seaborn <mseaborn@onetel.com> writes:
> 
> > Do you know what the problem is and whether it is simple to fix?
> 
> I can reproduce this problem with Emacs 21.4 but not with the CVS
> version, so it's been fixed already.  It's hard to tell which change
> fixed it, since the Emacs 21 and Emacs 22 codebases have diverged
> significantly in the 4 years that have passed since the 21.1 release.

Thanks for checking.

It turned out that I was wrong, and the use of address space does
change when you invoke ld-linux.so.2 directly: brk() changes where it
allocates memory from.  So I can fill in the gaps from the description
I posted before.  brk() starts allocating from after the BSS
(zero-initialised) segment of the executable that was invoked by
exec().  For normal executables this is after 0x08000000.
ld-linux.so.2 gets loaded at 0x80000000, so brk() follows from
somewhere after that (regardless of what executable ld-linux.so.2
subsequently loads).

Emacs allocates memory using malloc(), which uses brk(), and so it
gets an address with one of the top 4 bits set, which it can't handle.

I would guess that Emacs' use of the top 4 bits hasn't changed but
rather Emacs 22 uses mmap() to allocate memory rather than malloc().

I suppose Emacs 21 could be fixed to use mmap() rather than malloc(),
though I don't know whether you'd want to make a change like that in
the stable branch.  For running programs under Plash, I could change
libc's behaviour so that malloc() uses mmap() rather than brk(), which
would then work with any version of Emacs.

Mark

  reply	other threads:[~2005-11-14 13:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.14913.1131738962.20277.bug-gnu-emacs@gnu.org>
2005-11-11 23:47 ` "/lib/ld-linux.so.2 /usr/bin/emacs" fails: "Memory exhausted" Romain Francoise
2005-11-14 13:38   ` Mark Seaborn [this message]
2005-11-11 19:57 Mark Seaborn
2005-11-13 20:54 ` Richard M. Stallman
2005-11-15  0:34   ` Mark Seaborn

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20051114.133819.846939628.mrs@localhost \
    --to=mseaborn@onetel.com \
    --cc=romain@orebokech.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).