[Top][All Lists]

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

Re: "/lib/ld-linux.so.2 /usr/bin/emacs" fails: "Memory exhausted"

From: Mark Seaborn
Subject: Re: "/lib/ld-linux.so.2 /usr/bin/emacs" fails: "Memory exhausted"
Date: Mon, 14 Nov 2005 13:38:19 +0000 (GMT)

Romain Francoise <address@hidden> wrote:

> Mark Seaborn <address@hidden> 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.


reply via email to

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