The Carbon version of XEmacs sets the size of the stack explicitly.
(see run.c:		int stack_size = 0x800000;	/* moby */)
The Carbon version is two cooperative threads. The main thread fields  
Carbon events. The second thread is XEmacs.  The line of code above  
sets the stack size of the second thread (XEmacs).
I recently set the stack size to 8MB per Royar's suggestion. Carbon  
XEmacs no longer crashes with a segmentation fault in the regex code  
when opening a file in shell-mode (my .tcshrc file for example).
Rather than crashing with a segmentation fault it fails with a warning.  
  I can ignore the warning and proceed to edit my .tcshrc file, but only  
in fundamental mode.
The warning is:
(1) (file-mode-spec/warning) Error in File mode specification: sh-mode
Backtrace follows:
   signal(error ("sh-mode"))
   # bind (args datum)
   cerror("%s" sh-mode)
   apply(cerror "%s" sh-mode)
   # bind (args datum)
   error("%s" sh-mode)
   # bind (name alist mode name keep-going)
   # (unwind-protect ...)
   # bind (just-from-file-name)
   set-auto-mode()
   #<compiled-function nil "...(5)" [set-auto-mode t] 1>()
   # (unwind-protect ...)
   call-with-condition-handler(#<compiled-function  
(__call_trapping_errors_arg__) "...(17)" [__call_trapping_errors_arg__  
errstr error-message-string lwarn file-mode-spec warning "Error in %s:  
%s\n\nBacktrace follows:\n\n%s" "File mode specification"  
backtrace-in-condition-handler-eliminating-handler] 8>  
#<compiled-function nil "...(5)" [set-auto-mode t] 1>)
   # (condition-case ... . ((error)))
   # bind (find-file)
   normal-mode(t)
   # bind (nomodes after-find-file-from-revert-buffer noauto warn error)
   after-find-file(nil t)
   byte-code("..." [buffer-file-number number truename  
buffer-file-truename buf buffer-file-name set-buffer-major-mode  
erase-buffer nil (byte-code "´á¬	√\"à™Öƒ	√\"à¬á" [rawfile filename  
insert-file-contents-literally t insert-file-contents] 3) ((file-error  
(byte-code "√\n!´åƒ\n!¨á≈∆«\nD\"à´Ñ»™á… !¨Ç»√á" [rawfile error  
filename file-exists-p file-readable-p signal file-error "File is not  
readable" t run-hook-with-args-until-success find-file-not-found-hooks]  
4))) abbreviate-file-name file-name-directory make-local-variable  
backup-inhibited t after-find-file find-file-use-truenames  
default-directory backup-enable-predicate rawfile error nowarn] 3)
   # (condition-case ... . ((t (byte-code "¬!à√	@	A\"á" [buf data  
kill-buffer signal] 3))))
   # (unwind-protect ...)
   # bind (error number truename buf rawfile nowarn filename)
   find-file-noselect("~/.tcshrc")
   # bind (codesys filename)
   find-file("~/.tcshrc" nil)
   # bind (command-debug-status)
   call-interactively(find-file)
   # (condition-case ... . error)
   # (catch top-level ...)
On Monday, December 16, 2002, at 02:58 PM, robert delius royar wrote:
 On Sat, 14 Dec 2002, Stephen J. Turnbull wrote:
> So it looks like this has something to do with the implementation of
> alloca that isn't glibc related, right?
>
>>> Compiling with -DREGEX_MALLOC "fixes".
>
>     robert> Perhaps this would allow me to recompile with a smaller
>     robert> stack.  An 8 MB stack prevents the Carbonized program from
>     robert> being debugged in Project Developer.
>
> That's what I would expect.  However, I think that you still need a
> bigger than default stack.  Let me know how it works and if it does
> I'll add it to PROBLEMS and INSTALL in the appropriate places.  If you
> get any results about just how small the stack can be, that would be
> appreciated, too.
 Using the define REGEX_MALOC and compiling with --pdump (without X11),  
 both
 the terminal version of XEmacs and the Carbonized version now work  
 with a
 stack of only 6MB.  A 4MB stack crashes with complex html code and  
 font-lock
 turned on, but the 6MB version handled that fine.  The 6MB version has  
 the
 added advantage that it can be loaded for debugging using Apple's  
 Project
 Builder where the 8MB version I had been using could not load.  I think
 Carbonized applications are started with stack assigned differently  
 from the
 way that terminal applications are, but I am not very familiar with the
 inner workings of Apple.  My system is a 512MB OS X 10.2.2 PowerBook.
 --  
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
 =-=-=-=-=-
 Dr. Robert D. Royar      Morehead State University            
 royar(a)adelphia.net
                          T r a f f i c expands to exceed the available  
 roadway.
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
 =-=-=-=-=