From c2b10dc4d83b4bfba357eb6cfc4b7698dc8fef1c Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 31 Oct 2006 18:41:16 +0000 Subject: * cygheap.h (struct user_heap_info): Add slop member. * heap.cc (heap_init): Add slop factor to heap allocation. Add comment. * mmap.cc (MapViewNT): Allocate memory maps top down. (fhandler_dev_zero::mmap): Ditto. * shared.cc (shared_info::heap_slop_size): New method. (shared_info::heap_chunk_size): Don't use debug_printf at early stage. * shared_info.h (SHARED_INFO_CB): Accomodate change to shared_info. (CURR_SHARED_MAGIC): Ditto. (class shared_info): Add heap_slop member. Declare heap_slop_size. * wincap.h: Define heapslop throughout. * wincap.cc: Ditto. --- winsup/cygwin/shared.cc | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'winsup/cygwin/shared.cc') diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index 65965b58b..4c4b7bc72 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -234,6 +234,33 @@ memory_init () mtinfo_init (); } +unsigned +shared_info::heap_slop_size () +{ + if (!heap_slop) + { + /* Fetch from registry, first user then local machine. */ + for (int i = 0; i < 2; i++) + { + reg_key reg (i, KEY_READ, NULL); + + if ((heap_slop = reg.get_int ("heap_slop_in_mb", 0))) + break; + heap_slop = wincap.heapslop (); + } + + if (heap_slop < 0) + heap_slop = 0; + else + heap_slop <<= 20; +#ifdef DEBUGGING + system_printf ("fixed heap slop is %p", heap_slop); +#endif + } + + return heap_slop; +} + unsigned shared_info::heap_chunk_size () { @@ -260,7 +287,9 @@ shared_info::heap_chunk_size () heap_chunk <<= 20; if (!heap_chunk) heap_chunk = 384 * 1024 * 1024; - debug_printf ("fixed heap size is %u", heap_chunk); +#ifdef DEBUGGING + system_printf ("fixed heap size is %u", heap_chunk); +#endif } return heap_chunk; -- cgit v1.2.3