emacs-devel
[Top][All Lists]
Advanced

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

Emacs hang under cygwin 1.5.21


From: Sean M. Paus
Subject: Emacs hang under cygwin 1.5.21
Date: Sat, 30 Sep 2006 16:57:01 -0400
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)

Originally posted some of this to help-gnu-emacs.  It was suggested that
I post here to emacs-devel.  I've also posted a version of this to the
cygwin mailing list (no responses yet).

I've recently upgraded my cygwin installation to 1.5.21.  Since then, I
have had no luck getting emacs to run.  I've tried the stock 21.2 that
comes with the cygwin distribution, the test 21.3 that was posted a
while back, and I've even downloaded and (well half) built the latest
sources from the emacs CVS repository.  I can't get past the first
execution of bootstrap-emacs.exe.

The problem is that emacs just hangs and takes up gobs of CPU.  I
ultimately tracked this down to a tight infinite loop in
_malloc_internal (gmalloc.c).  For some reason, align (also in
gmalloc.c) is returning a pointer that is smaller than _heapbase.  The
calculation to determine what block the newly requested memory is in
(BLOCK(result+size)) returns a ridiculously huge number.  Since
_malloc_internal incrementally doubles the new size of the heap until
the requested memory fits, at some point the multiplication overflows
and newsize gets a value of 0.  Since 0 * 2 is always zero, the test for
BLOCK(result+size) > newsize always succeeds and _malloc_internal
gets stuck in a tight loop multiplying 0 by 2 forever.

For example, _heapbase is something around 0x203f4000, but align (really
sbrk) returns 0x642000.

I've tried to track down why this is happening, but it just gets weirder
the more I look.  temacs.exe runs with no problem because something
called bss_sbrk is used to increase the heap.  However, before temacs
exits it strips out all of the bss_sbrk stuff, falling back to the
standard sbrk.  It's the standard sbrk that is returning a pointer <
_heapbase.

Additionally, (in bootstrap-emacs.exe) _malloc_initialize (in gmalloc.c)
doesn't appear to be called, ever, which makes me wonder how _heapinfo
and _heapbase are ever being initialized.  I ran boostrap-emacs.exe
under gdb and had it break in malloc_initialize (somewhere in
cygwin1.dll) to see if I could trace when emacs' _malloc_initialize was
called.  Surprisingly, _malloc_initialized (also in gmalloc.c) already
had a value of 1.

I have had no luck finding the change to cygwin that caused this.
Reputedly, this has been a problem since the 1.5.19 version of cygwin1.dll.

Any thoughts?

Sean

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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