aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/cygheap.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-03-21 22:24:06 +0000
committerChristopher Faylor <me@cgf.cx>2004-03-21 22:24:06 +0000
commitc7c7492aabeea5fd7cc32870508b860f794374c1 (patch)
tree49393d29295fa042a3ad3f38057e4f61b7f3a6a9 /winsup/cygwin/cygheap.cc
parente362f67fefb12b772ebaccb8a65f2002d467faf5 (diff)
downloadnewlib-c7c7492aabeea5fd7cc32870508b860f794374c1.zip
newlib-c7c7492aabeea5fd7cc32870508b860f794374c1.tar.gz
newlib-c7c7492aabeea5fd7cc32870508b860f794374c1.tar.bz2
* cygheap.cc (init_cheap): Set initial_sz to something or suffer spurious
output. (cygheap_fixup_in_child): Set alloc_sz to passed in size to ensure that children will have the right size heap. (_csbrk): Make output conditional on DEBUGGING.
Diffstat (limited to 'winsup/cygwin/cygheap.cc')
-rw-r--r--winsup/cygwin/cygheap.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index 68b5346..b32afd0 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -57,7 +57,7 @@ init_cheap ()
char buf[80];
DWORD initial_sz = 0;
if (!GetEnvironmentVariable ("CYGWIN_HEAPSIZE", buf, sizeof buf - 1))
- alloc_sz = CYGHEAPSIZE;
+ initial_sz = alloc_sz = CYGHEAPSIZE;
else
{
initial_sz = alloc_sz = atoi (buf);
@@ -148,14 +148,14 @@ cygheap_fixup_in_child (bool execed)
void *newaddr;
newaddr = MapViewOfFileEx (child_proc_info->cygheap_h, MVMAP_OPTIONS, 0, 0, 0, addr);
+ alloc_sz = child_proc_info->cygheap_alloc_sz;
if (newaddr != cygheap)
{
if (!newaddr)
newaddr = MapViewOfFileEx (child_proc_info->cygheap_h, MVMAP_OPTIONS, 0, 0, 0, NULL);
DWORD n = (DWORD) cygheap_max - (DWORD) cygheap;
/* Reserve cygwin heap in same spot as parent */
- if (!VirtualAlloc (cygheap, child_proc_info->cygheap_alloc_sz,
- MEM_RESERVE, PAGE_NOACCESS))
+ if (!VirtualAlloc (cygheap, alloc_sz, MEM_RESERVE, PAGE_NOACCESS))
{
MEMORY_BASIC_INFORMATION m;
memset (&m, 0, sizeof m);
@@ -231,7 +231,7 @@ _csbrk (int sbs)
/* nothing to do */;
else if (!VirtualAlloc (prebrk, (DWORD) sbs, MEM_COMMIT, PAGE_READWRITE))
{
-#if 1
+#ifdef DEBUGGING
system_printf ("couldn't commit memory for cygwin heap, prebrk %p, size %d, heapsize now %d, max heap size %u, %E",
prebrk, sbs, (char *) cygheap_max - (char *) cygheap,
alloc_sz);