unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Sean M. Paus" <spaus@pobox.com>
Subject: Emacs hang under cygwin 1.5.21
Date: Sat, 30 Sep 2006 16:57:01 -0400	[thread overview]
Message-ID: <451EDA1D.3070507@pobox.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2398 bytes --]

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 #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

                 reply	other threads:[~2006-09-30 20:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=451EDA1D.3070507@pobox.com \
    --to=spaus@pobox.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).