emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r107972: Fix failures in starting


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r107972: Fix failures in starting subprocesses on Windows 7.
Date: Sat, 05 May 2012 11:40:31 +0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107972
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Sat 2012-05-05 11:40:31 +0300
message:
  Fix failures in starting subprocesses on Windows 7.
  
   src/w32proc.c (new_child): Force Windows to reserve only 64KB of
   stack for each reader_thread, instead of defaulting to 8MB
   determined by the linker.  This avoids failures in creating
   subprocesses on Windows 7, see the discussion in this thread:
   http://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00119.html.
modified:
  src/ChangeLog
  src/w32proc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-05-02 10:12:13 +0000
+++ b/src/ChangeLog     2012-05-05 08:40:31 +0000
@@ -1,3 +1,11 @@
+2012-05-05  Eli Zaretskii  <address@hidden>
+
+       * w32proc.c (new_child): Force Windows to reserve only 64KB of
+       stack for each reader_thread, instead of defaulting to 8MB
+       determined by the linker.  This avoids failures in creating
+       subprocesses on Windows 7, see the discussion in this thread:
+       http://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00119.html.
+
 2012-05-02  Jim Meyering  <address@hidden>
 
        * w32font.c (fill_in_logfont): NUL-terminate a string (Bug#11372).

=== modified file 'src/w32proc.c'
--- a/src/w32proc.c     2012-03-20 18:49:18 +0000
+++ b/src/w32proc.c     2012-05-05 08:40:31 +0000
@@ -141,7 +141,25 @@
       cp->char_consumed = CreateEvent (NULL, FALSE, FALSE, NULL);
       if (cp->char_consumed)
         {
-         cp->thrd = CreateThread (NULL, 1024, reader_thread, cp, 0, &id);
+         /* The 0x00010000 flag is STACK_SIZE_PARAM_IS_A_RESERVATION.
+            It means that the 64K stack we are requesting in the 2nd
+            argument is how much memory should be reserved for the
+            stack.  If we don't use this flag, the memory requested
+            by the 2nd argument is the amount actually _committed_,
+            but Windows reserves 8MB of memory for each thread's
+            stack.  (The 8MB figure comes from the -stack
+            command-line argument we pass to the linker when building
+            Emacs, but that's because we need a large stack for
+            Emacs's main thread.)  Since we request 2GB of reserved
+            memory at startup (see w32heap.c), which is close to the
+            maximum memory available for a 32-bit process on Windows,
+            the 8MB reservation for each thread causes failures in
+            starting subprocesses, because we create a thread running
+            reader_thread for each subprocess.  As 8MB of stack is
+            way too much for reader_thread, forcing Windows to
+            reserve less wins the day.  */
+         cp->thrd = CreateThread (NULL, 64 * 1024, reader_thread, cp,
+                                  0x00010000, &id);
          if (cp->thrd)
            return cp;
        }


reply via email to

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