Shrinking with realloc

John F. Haugh II jfh at rpp386.Dallas.TX.US
Fri Aug 11 15:36:37 AEST 1989


In article <10698 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
>In article <26328 at shemp.CS.UCLA.EDU> signup at CS.UCLA.EDU writes:
>>If realloc is used to shrink a chunk of allocated storage, is it guaranteed
>>by the standard that the storage won't be moved?
>
>No, the storage is always potentially subject to being moved by realloc(),
>perhaps as part of the malloc package's grand allocation scheme.

Perhaps also because the headers required for each block may be larger
than the amount of free space returned.

It is not generally true that the space being returned can be tacked
on to some larger region leaving the remainder alone.
-- 
John F. Haugh II                        +-Quote of the month club: ------------
VoiceNet: (512) 832-8832   Data: -8835  | "Chocolate Teddy Grahams are just
InterNet: jfh at rpp386.cactus.org         |  reincarnated Space Food Sticks."
UUCPNet:  {texbell|bigtex}!rpp386!jfh   +------------     -- Richard Sexton ---



More information about the Comp.std.c mailing list