This is the mail archive of the
mailing list for the Cygwin project.
Re: malloc() problem
- From: Christopher Faylor <cgf-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 7 Feb 2003 01:39:41 -0500
- Subject: Re: malloc() problem
- References: <3E42E315.firstname.lastname@example.org>
- Reply-to: cygwin at cygwin dot com
On Thu, Feb 06, 2003 at 05:35:01PM -0500, Greg Smith wrote:
>>>There's also a bug right now that causes allocation of three times as
>>>much memory as Hercules actually calls for. (I believe that one's
>>>already been reported; it really hits Hercules hard, though, as it's
>>>not uncommon to have Hercules allocate 256 MB of memory for the
>>>emulated system's central storage, and a 768 MB allocation will drive
>>>most Windows boxes to their knees.)
>>I'm not aware of any bug report along these lines. I must have missed
>>A test case would be welcome.
>One of our developers has come up with a test case for this problem
>which I have pasted below. He's basically a windows programmer and
>I don't think he can write a short program to save his life ;-)
A test case is not a 218 line program. Sorry.
I did write a very small test case which malloced 4M and saw the problem
you described by watching memory size go up in task manager. The
problem seems to be due to the fact that the new version of malloc uses
mmap for requests over 256K and mmap is, for some reason, doubly
allocating private regions.
I've set the threshold up to a larger number in malloc and built a
new snapshot. This should work around the problem until we can figure
out what is going wrong with mmap. I've alerted our mmap maintainer
to the problem.
So, try the snapshot and see if it fixes your problem.
For your edification, the below is what I mean by a "test case". A
"test case" should be source code which demonstrates the problem in
the smallest amount of code possible. The below has an extra bell
or whistle but it at least should be understandable without a lot
main(int argc, char **argv)
unsigned size = strtoul (*++argv ?: "4194304", &p, 0);
printf ("pid %d\n", getpid());
for (i = 0; i < 1000; i++)
Please use the resources at cygwin.com rather than sending personal email.
Special for spam email harvesters: send email to email@example.com
and be permanently blocked from mailing lists at sources.redhat.com
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html