Index: heap.cc =================================================================== RCS file: /cvs/src/src/winsup/cygwin/heap.cc,v retrieving revision 1.39 diff -u -p -r1.39 heap.cc --- heap.cc 14 Jan 2004 15:45:36 -0000 1.39 +++ heap.cc 3 Feb 2004 01:18:58 -0000 @@ -30,6 +30,38 @@ extern "C" size_t getpagesize (); #define MINHEAP_SIZE (4 * 1024 * 1024) +static unsigned +heap_chunk_size () +{ + unsigned int heap_chunk; + + /* Fetch misc. registry entries. */ + + reg_key reg (KEY_READ, NULL); + + /* Note that reserving a huge amount of heap space does not result in + the use of swap since we are not committing it. */ + /* FIXME: We should not be restricted to a fixed size heap no matter + what the fixed size is. */ + + heap_chunk = reg.get_int ("heap_chunk_in_mb", 0); + if (!heap_chunk) { + reg_key r1 (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE", + CYGWIN_INFO_CYGNUS_REGISTRY_NAME, + CYGWIN_INFO_CYGWIN_REGISTRY_NAME, NULL); + heap_chunk = r1.get_int ("heap_chunk_in_mb", 384); + } + + if (!heap_chunk) + heap_chunk = MINHEAP_SIZE; + else if (!(heap_chunk <<= 20)) + heap_chunk = 384 * 1024 * 1024; + + debug_printf ("fixed heap size is %u", heap_chunk); + + return heap_chunk; +} + /* Initialize the heap at process start up. */ void heap_init () @@ -40,7 +72,7 @@ heap_init () page_const = system_info.dwPageSize; if (!cygheap->user_heap.base) { - cygheap->user_heap.chunk = cygwin_shared->heap_chunk_size (); + cygheap->user_heap.chunk = heap_chunk_size (); while (cygheap->user_heap.chunk >= MINHEAP_SIZE) { /* Initialize page mask and default heap size. Preallocate a heap Index: shared.cc =================================================================== RCS file: /cvs/src/src/winsup/cygwin/shared.cc,v retrieving revision 1.80 diff -u -p -r1.80 shared.cc --- shared.cc 1 Dec 2003 15:03:43 -0000 1.80 +++ shared.cc 3 Feb 2004 01:18:58 -0000 @@ -244,37 +244,3 @@ memory_init () user_shared_initialize (false); } - -unsigned -shared_info::heap_chunk_size () -{ - if (!heap_chunk) - { - /* Fetch misc. registry entries. */ - - reg_key reg (KEY_READ, NULL); - - /* Note that reserving a huge amount of heap space does not result in - the use of swap since we are not committing it. */ - /* FIXME: We should not be restricted to a fixed size heap no matter - what the fixed size is. */ - - heap_chunk = reg.get_int ("heap_chunk_in_mb", 0); - if (!heap_chunk) { - reg_key r1 (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE", - CYGWIN_INFO_CYGNUS_REGISTRY_NAME, - CYGWIN_INFO_CYGWIN_REGISTRY_NAME, NULL); - heap_chunk = r1.get_int ("heap_chunk_in_mb", 384); - } - - if (heap_chunk < 4) - heap_chunk = 4 * 1024 * 1024; - else - heap_chunk <<= 20; - if (!heap_chunk) - heap_chunk = 384 * 1024 * 1024; - debug_printf ("fixed heap size is %u", heap_chunk); - } - - return heap_chunk; -}