aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Brown2013-08-18 13:37:31 -0400
committerKen Brown2013-08-18 13:37:31 -0400
commitf747d82e08b4d1201fa08cfee090759f7a6ef5b1 (patch)
treed1e6b4716f818e3bb3a66e31fcea298307f43202
parentd2c28fab135742b98466345f933c2f0c1608569c (diff)
downloademacs-f747d82e08b4d1201fa08cfee090759f7a6ef5b1.tar.gz
emacs-f747d82e08b4d1201fa08cfee090759f7a6ef5b1.zip
Change size of static heap on Cygwin; report maximum usage after dumping.
* src/sheap.c (STATIC_HEAP_SIZE): Adjust to current needs; use bigger static heap if ENABLE_CHECKING is defined. (max_bss_sbrk_ptr): New variable. (bss_sbrk): Use it. (report_sheap_usage): Report maximum static heap usage instead of ending static heap usage.
-rw-r--r--src/ChangeLog9
-rw-r--r--src/sheap.c17
2 files changed, 23 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7a875ae63bc..671f6afc722 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12013-08-18 Ken Brown <kbrown@cornell.edu>
2
3 * sheap.c (STATIC_HEAP_SIZE): Adjust to current needs; use bigger
4 static heap if ENABLE_CHECKING is defined.
5 (max_bss_sbrk_ptr): New variable.
6 (bss_sbrk): Use it.
7 (report_sheap_usage): Report maximum static heap usage instead of
8 ending static heap usage.
9
12013-08-17 Eli Zaretskii <eliz@gnu.org> 102013-08-17 Eli Zaretskii <eliz@gnu.org>
2 11
3 * decompress.c (Fzlib_available_p) [WINDOWSNT]: Update the value 12 * decompress.c (Fzlib_available_p) [WINDOWSNT]: Update the value
diff --git a/src/sheap.c b/src/sheap.c
index 54eef60c27d..daff0c1d700 100644
--- a/src/sheap.c
+++ b/src/sheap.c
@@ -26,10 +26,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26#include <unistd.h> 26#include <unistd.h>
27 27
28#ifdef __x86_64__ 28#ifdef __x86_64__
29#ifdef ENABLE_CHECKING
30#define STATIC_HEAP_SIZE (28 * 1024 * 1024)
31#else
32#define STATIC_HEAP_SIZE (19 * 1024 * 1024)
33#endif
34#else /* x86 */
35#ifdef ENABLE_CHECKING
29#define STATIC_HEAP_SIZE (18 * 1024 * 1024) 36#define STATIC_HEAP_SIZE (18 * 1024 * 1024)
30#else 37#else
31#define STATIC_HEAP_SIZE (13 * 1024 * 1024) 38#define STATIC_HEAP_SIZE (13 * 1024 * 1024)
32#endif 39#endif
40#endif /* x86 */
33 41
34int debug_sheap = 0; 42int debug_sheap = 0;
35 43
@@ -37,6 +45,7 @@ int debug_sheap = 0;
37 45
38char bss_sbrk_buffer[STATIC_HEAP_SIZE]; 46char bss_sbrk_buffer[STATIC_HEAP_SIZE];
39char *bss_sbrk_ptr; 47char *bss_sbrk_ptr;
48char *max_bss_sbrk_ptr;
40int bss_sbrk_did_unexec; 49int bss_sbrk_did_unexec;
41 50
42void * 51void *
@@ -44,7 +53,7 @@ bss_sbrk (ptrdiff_t request_size)
44{ 53{
45 if (!bss_sbrk_ptr) 54 if (!bss_sbrk_ptr)
46 { 55 {
47 bss_sbrk_ptr = bss_sbrk_buffer; 56 max_bss_sbrk_ptr = bss_sbrk_ptr = bss_sbrk_buffer;
48#ifdef CYGWIN 57#ifdef CYGWIN
49 sbrk (BLOCKSIZE); /* force space for fork to work */ 58 sbrk (BLOCKSIZE); /* force space for fork to work */
50#endif 59#endif
@@ -85,6 +94,8 @@ bss_sbrk (ptrdiff_t request_size)
85 if (debug_sheap) 94 if (debug_sheap)
86 printf ("allocated 0x%08x size %d\n", ret, request_size); 95 printf ("allocated 0x%08x size %d\n", ret, request_size);
87 bss_sbrk_ptr += (int) request_size; 96 bss_sbrk_ptr += (int) request_size;
97 if (bss_sbrk_ptr > max_bss_sbrk_ptr)
98 max_bss_sbrk_ptr = bss_sbrk_ptr;
88 return ret; 99 return ret;
89 } 100 }
90} 101}
@@ -93,8 +104,8 @@ void
93report_sheap_usage (int die_if_pure_storage_exceeded) 104report_sheap_usage (int die_if_pure_storage_exceeded)
94{ 105{
95 char buf[200]; 106 char buf[200];
96 sprintf (buf, "Static heap usage: %d of %d bytes", 107 sprintf (buf, "Maximum static heap usage: %d of %d bytes",
97 bss_sbrk_ptr - bss_sbrk_buffer, STATIC_HEAP_SIZE); 108 max_bss_sbrk_ptr - bss_sbrk_buffer, STATIC_HEAP_SIZE);
98 /* Don't log messages, cause at this point, we're not allowed to create 109 /* Don't log messages, cause at this point, we're not allowed to create
99 buffers. */ 110 buffers. */
100 message1_nolog (buf); 111 message1_nolog (buf);