From: winalski@adserv.enet.dec.com (Paul S. Winalski)
Subject: Re: VMS free() broken -- the saga continues
Date: Fri, 25 Sep 1992 16:22:42 GMT [thread overview]
Message-ID: <1992Sep25.162242.21373@rdg.dec.com> (raw)
In-Reply-To: hansg.717412853@risken
In article <hansg.717412853@risken>,
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?
The only cases where I've ever seen this happen is where the user code between
the two calls to malloc() (the "..." in your example) have written outside
the allocated bounds of the memory and have damaged the control blocks that
malloc() uses to maintain its free storage pool. This can happen if, for
example, you malloc9() a string and fail to account for the NUL byte that
must terminate it (if you want a string 100 characters long, you must allocate
101 bytes). Just about any user programming error that causes memory
corruption (for example, arrays out of bounds, returning a pointer to an
auto variable, bad pointer arithmetic, writing outside the bounds of
malloc()'d memory) can cause this to happen.
Bottom line: there is indeed a bug somewhere, and it's 99.999% likely that
it's in your code, not in malloc().
--PSW
next prev parent reply other threads:[~1992-09-25 16:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1992-09-25 9:20 VMS free() broken -- the saga continues Hans Granqvist
1992-09-25 15:23 ` Jeff Diewald
1992-09-25 20:28 ` Charles M Richmond
1992-09-25 16:22 ` Paul S. Winalski [this message]
1992-09-25 16:59 ` Paul S. Winalski
1992-09-28 16:06 ` jmeinke
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox