Xref: utzoo comp.lang.c:40241 comp.os.msdos.programmer:5736 Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!stanford.edu!agate!ucbvax!ucdavis!csus.edu!borland.com!alexande From: alexande@borland.com (Mark Alexander) Newsgroups: comp.lang.c,comp.os.msdos.programmer Subject: Re: Does TC's farrealloc have a bug? Message-ID: <1991Jun19.230537.2976@borland.com> Date: 19 Jun 91 23:05:37 GMT References: <1991Jun19.083945.8921@ucthpx.uct.ac.za> Organization: Borland International Lines: 15 (Email bounced yet again, sorry.) The far heap in BC++ has 16-byte granularity, and 4 bytes of overhead per block. What this means is that each block is allocated on a 16-byte boundary, and the first four bytes of each block are reserved. If you look at the pointers returned by farmalloc() and farrealloc(), you'll see that they're all in the form xxxx:0004. So if your program allocates a 6-byte block, you'll actually use up 16 bytes. A 12-byte allocation would also use 16 bytes, but a 13-byte allocation would use 32 bytes. One solution is allocate two of your 6-byte structures in one call to farmalloc(), but this may make your program ugly.