Path: utzoo!attcan!uunet!cs.utexas.edu!execu!sequoia!rpp386!jfh
From: jfh@rpp386.Dallas.TX.US (John F. Haugh II)
Newsgroups: comp.std.c
Subject: Re: Shrinking with realloc
Message-ID: <16884@rpp386.Dallas.TX.US>
Date: 11 Aug 89 05:36:37 GMT
References: <26328@shemp.CS.UCLA.EDU> <10698@smoke.BRL.MIL>
Reply-To: jfh@rpp386.cactus.org (John F. Haugh II)
Organization: I am NOT the NRA
Lines: 18

In article <10698@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes:
>In article <26328@shemp.CS.UCLA.EDU> signup@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@rpp386.cactus.org         |  reincarnated Space Food Sticks."
UUCPNet:  {texbell|bigtex}!rpp386!jfh   +------------     -- Richard Sexton ---