diff --git a/src/backend/storage/ipc/ipc.c b/src/backend/storage/ipc/ipc.c
index cc36b80..7740120 100644
*** a/src/backend/storage/ipc/ipc.c
--- b/src/backend/storage/ipc/ipc.c
*************** static int	on_proc_exit_index,
*** 98,106 ****
--- 98,113 ----
  void
  proc_exit(int code)
  {
+ 	char	sysbuf[256];
+ 
  	/* Clean up everything that must be cleaned up */
  	proc_exit_prepare(code);
  
+ 	/* report stack size to stderr */
+ 	snprintf(sysbuf, sizeof(sysbuf), "pmap %d | grep stack 1>&2",
+ 			 (int) getpid());
+ 	system(sysbuf);
+ 
  #ifdef PROFILE_PID_DIR
  	{
  		/*
diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h
index 7254355..009bec2 100644
*** a/src/include/tcop/tcopprot.h
--- b/src/include/tcop/tcopprot.h
***************
*** 27,33 ****
  
  
  /* Required daylight between max_stack_depth and the kernel limit, in bytes */
! #define STACK_DEPTH_SLOP (512 * 1024L)
  
  extern CommandDest whereToSendOutput;
  extern PGDLLIMPORT const char *debug_query_string;
--- 27,33 ----
  
  
  /* Required daylight between max_stack_depth and the kernel limit, in bytes */
! #define STACK_DEPTH_SLOP (-100 * 1024L * 1024L)
  
  extern CommandDest whereToSendOutput;
  extern PGDLLIMPORT const char *debug_query_string;
