delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
X-Info: | This message was accepted for relay by |
smtp03.mrf.mail.rcn.net as the sender used SMTP authentication | |
X-Trace: | UmFuZG9tSVYSm3eQqAGqrmnfOXRpXzaGdHyO30KLuVvOfGq/ojysUJbf9CWG3qIF |
Message-ID: | <3F44389B.4040501@cygwin.com> |
Date: | Wed, 20 Aug 2003 23:12:27 -0400 |
From: | Larry Hall <cygwin-lh AT cygwin DOT com> |
Reply-To: | cygwin AT cygwin DOT com |
User-Agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030718 |
X-Accept-Language: | en-us, en |
MIME-Version: | 1.0 |
To: | roconnor <roconnor AT hsc DOT usf DOT edu> |
CC: | cygwin AT cygwin DOT com |
Subject: | Re: 1.3.22-1 on XP: malloc returns overlapping buffers |
References: | <20030820200711 DOT GA3964 AT delwin> |
In-Reply-To: | <20030820200711.GA3964@delwin> |
roconnor wrote: > I am finding that under some circumstances a buffer returned by malloc > will overlap with a buffer returned by a previous call to malloc that > has not been freed. I was able to reduce it to the following test > case. Running under cygwin 1.3.22-1 on Windows XP Professional > Version 2002 SP1 it reports an overlap of 4824 bytes on two different > machines, as well as on a third machine running Windows 2000 5.00.2195 > SP4. On Windows NT 4.0.1381, it finds no overlap. > > Am I doing something wrong or is there a bug in malloc or XP? More > details below. > > ------------------------------------------------------------------------ > > #include <stdio.h> > #include <stdlib.h> > > int > main (int argc, char **argv) > { > char *mm = 0, *p; > int size = 8000, overlap; > > p = malloc (1); > > while (mm < p) { > mm = malloc (16777216); > if (mm == 0) { > printf ("not enough memory to run test\n"); > exit (0); > } > printf ("malloc (16777216) = %d\n", (int)mm); > } > > while ((p = malloc (size))) { > overlap = (int)p + size - (int)mm; > if (p < mm && overlap > 0) { > printf ("overlap = %d\n", overlap); > exit (1); > } > } > return 0; > } > > ------------------------------------------------------------------------ This works OK for me on W2K SP1 with cygwin 1.5.x. Maybe you want to upgrade to this (i.e. the test version) and see if you still see the problem. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 838 Washington Street (508) 893-9889 - FAX Holliston, MA 01746 ################################################################# ################################################################# ################################################################# ##### ##### ##### ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ##### ##### ##### ################################################################# ################################################################# ################################################################# -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |