From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,504e971efe6c792a X-Google-Attributes: gidf7344,public X-Google-Thread: 1164f8,504e971efe6c792a X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1992-09-25 06:26:50 PST Xref: sparky comp.os.vms:15611 comp.sys.dec:5221 Newsgroups: comp.os.vms,comp.sys.dec Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!gatech!swrinde!sdd.hp.com!decwrl!pa.dec.com!nntpd2.cxo.dec.com!adserv.enet.dec.com!winalski From: winalski@adserv.enet.dec.com (Paul S. Winalski) Subject: Re: VMS free() broken -- the saga continues Message-ID: <1992Sep25.165937.29035@nntpd2.cxo.dec.com> Sender: usenet@nntpd2.cxo.dec.com (USENET News System) Reply-To: winalski@adserv.enet.dec.com (Paul S. Winalski) Organization: Digital Equipment Corporation, Nashua NH References: Date: Fri, 25 Sep 1992 16:59:37 GMT In article , hansg@risken.vd.volvo.se (Hans Granqvist) writes: |> |>Has anyone encountered this problem? |>A malloc() succeeding another malloc() returns a pointer to an area |>OVERLAYING the previous, and no free() has been made between them, i.e., |> |>a = malloc(100); |>... |>b = malloc(100); |> |>where a may turn out address 10000 and b address 10070 (construed |>addresses here!) |> |>Is th is behaviour at all legal in any way? Does VMS malloc sometimes |>return some sort of "shared memory" or what IN THE NAME OF KEN OLSEN is |>this? Indeed what you describe is not supposed to happen. There is a bug somewhere, but it's 99.999% likely that it's in your code, not in malloc(). If your program writes on top of the data structures that malloc() uses to keep track of its free memory pools, things like this can happen. Look for arrays out of bounds, cases of allocating less memory than you actually are using (for example, if you're going to strcpy() a 100 byte string, the destination must be 101 bytes long), passing pointers to variables of storage class auto out of the routine where they're declared, bad pointer arithmetic, etc. --PSW