aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2012-05-05 11:40:31 +0300
committerEli Zaretskii2012-05-05 11:40:31 +0300
commit0d887c7d51e28455da610a730f20631eaa0533b6 (patch)
tree9760227a65e34f24a82ebf94ac4a6195535a503e /src
parentf677562b6c90b283d338725992d87a2770848560 (diff)
downloademacs-0d887c7d51e28455da610a730f20631eaa0533b6.tar.gz
emacs-0d887c7d51e28455da610a730f20631eaa0533b6.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/w32proc.c20
2 files changed, 27 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8aa1707cd30..1e6af943fb4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12012-05-05 Eli Zaretskii <eliz@gnu.org>
2
3 * w32proc.c (new_child): Force Windows to reserve only 64KB of
4 stack for each reader_thread, instead of defaulting to 8MB
5 determined by the linker. This avoids failures in creating
6 subprocesses on Windows 7, see the discussion in this thread:
7 http://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00119.html.
8
12012-05-02 Jim Meyering <meyering@redhat.com> 92012-05-02 Jim Meyering <meyering@redhat.com>
2 10
3 * w32font.c (fill_in_logfont): NUL-terminate a string (Bug#11372). 11 * w32font.c (fill_in_logfont): NUL-terminate a string (Bug#11372).
diff --git a/src/w32proc.c b/src/w32proc.c
index 28591f90128..5bdeba25958 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -141,7 +141,25 @@ new_child (void)
141 cp->char_consumed = CreateEvent (NULL, FALSE, FALSE, NULL); 141 cp->char_consumed = CreateEvent (NULL, FALSE, FALSE, NULL);
142 if (cp->char_consumed) 142 if (cp->char_consumed)
143 { 143 {
144 cp->thrd = CreateThread (NULL, 1024, reader_thread, cp, 0, &id); 144 /* The 0x00010000 flag is STACK_SIZE_PARAM_IS_A_RESERVATION.
145 It means that the 64K stack we are requesting in the 2nd
146 argument is how much memory should be reserved for the
147 stack. If we don't use this flag, the memory requested
148 by the 2nd argument is the amount actually _committed_,
149 but Windows reserves 8MB of memory for each thread's
150 stack. (The 8MB figure comes from the -stack
151 command-line argument we pass to the linker when building
152 Emacs, but that's because we need a large stack for
153 Emacs's main thread.) Since we request 2GB of reserved
154 memory at startup (see w32heap.c), which is close to the
155 maximum memory available for a 32-bit process on Windows,
156 the 8MB reservation for each thread causes failures in
157 starting subprocesses, because we create a thread running
158 reader_thread for each subprocess. As 8MB of stack is
159 way too much for reader_thread, forcing Windows to
160 reserve less wins the day. */
161 cp->thrd = CreateThread (NULL, 64 * 1024, reader_thread, cp,
162 0x00010000, &id);
145 if (cp->thrd) 163 if (cp->thrd)
146 return cp; 164 return cp;
147 } 165 }