Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!ittvax!swatt From: swatt@ittvax.UUCP (Alan S. Watt) Newsgroups: net.unix-wizards Subject: Re: Realloc for Storage Compaction Message-ID: <1140@ittvax.UUCP> Date: Tue, 29-Nov-83 15:53:10 EST Article-I.D.: ittvax.1140 Posted: Tue Nov 29 15:53:10 1983 Date-Received: Wed, 30-Nov-83 03:59:41 EST References: eosp1.399 Lines: 37 In V7 and 4.1, "diff" uses these strange properties. It also depends on the fact that memory released via "free" is not modified until the next "malloc" call. The term "compacting reallocation" is misleading as memory is not compacted in the usual sense of the word. What does happen is that the memory block is joined with adjacent blocks if they are free. If you're about to try out alternate implementations of "malloc" and friends, be aware that the following programs use "realloc" in some form or another: /usr/src/cmd: cron.c nm.c .../cifplot: alloc.c .../csh: (has its own copy of malloc.c) alloc.c .../diff: diff.c .../oldcsh: (has its own copy of malloc.c) alloc.c .../oldcsh: (has its own copy of malloc.c) malloc.c .../struct: 0.parts.c To my knowledge, only "diff" depends on realloc's strange properties. My notes on 4.2 state that the "malloc" routines are identical to those in 4.1, but that a new version was received and available for use. The diff as distributed in 4.1 will break if you substitute a scheme which alters memory on free operations. - Alan S. Watt