diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2006-10-31 18:41:16 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2006-10-31 18:41:16 +0000 |
commit | c2b10dc4d83b4bfba357eb6cfc4b7698dc8fef1c (patch) | |
tree | 90de2c2c6336df77e7916882eac81edc70b208ec /winsup/cygwin/shared.cc | |
parent | 9740f34d11c458fd7a07a025810422a6db1ad374 (diff) | |
download | cygnal-c2b10dc4d83b4bfba357eb6cfc4b7698dc8fef1c.tar.gz cygnal-c2b10dc4d83b4bfba357eb6cfc4b7698dc8fef1c.tar.bz2 cygnal-c2b10dc4d83b4bfba357eb6cfc4b7698dc8fef1c.zip |
* 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.
Diffstat (limited to 'winsup/cygwin/shared.cc')
-rw-r--r-- | winsup/cygwin/shared.cc | 31 |
1 files changed, 30 insertions, 1 deletions
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 @@ -235,6 +235,33 @@ memory_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 () { if (!heap_chunk) @@ -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; |