Does TC's farrealloc have a bug?
Richard Kooijman
kooijman at duteca.et.tudelft.nl
Thu Jun 20 17:46:13 AEST 1991
msmith%peruvian.utah.edu at cs.utah.edu (Matthew Smith) writes:
>>
>>i) either there is a bug in TC (actually TC++ v1.0) so that when realloc
>> fails to resize a block and allocates a new one it doesn't free the
>> old one; or
>>ii) the allocated blocks are being held on a linked list with an overhead of
>I've run across a similar situation. I was using realloc as opposed to
>farrealloc, and the same thing happened there. My conclusion after looking
>at several examples in the manuals is that they DON'T delete the old block.
>This conclusion was achieved by the fact that in all examples, they had a
>dummy pointer pointing to the current block, called realloc with their usual
>pointer, and then called free() with their dummy pointer (which really
>pointed to their old block). That's the way they want you to do it. I know,
>it really sucks.
I do not understand what you mean with this. In my opinion the problem is
caused by overhead and memory fragmentation.
The overhead isn't 12 bytes, I think, but 8 bytes as somebody mentioned here
a while ago.
Richard.
More information about the Comp.lang.c
mailing list