Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Fri, 7 Feb 2003 01:39:41 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: malloc() problem Message-ID: <20030207063941.GA2481@redhat.com> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <3E42E315 DOT 40705 AT nc DOT rr DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3E42E315.40705@nc.rr.com> User-Agent: Mutt/1.5.1i 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 >>it. >> >>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 of study. cgf #include #include int main(int argc, char **argv) { char *p; unsigned size = strtoul (*++argv ?: "4194304", &p, 0); int i; printf ("pid %d\n", getpid()); for (i = 0; i < 1000; i++) { char buf[16]; malloc (size); puts ("ding"); gets (buf); } } -- Please use the resources at cygwin.com rather than sending personal email. Special for spam email harvesters: send email to aaaspam AT sourceware DOT org 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 Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/