Kaffe/Alpha - bug fix ? finally?

Archie Cobbs archie at whistle.com
Tue Oct 10 10:25:47 PDT 2000


abnay at altavista.com writes:
> On Mon, 09 October 2000, Archie Cobbs wrote:
> > It's good to hear that your assertion failure was fixed,
> > but your fix sortof doesn't make sense. "osize" is the
> > correct thing to copy there, because the original memory
> > region presumably was only "osize" bytes long.
> 
> Pardon me if I am being dumb. Trying to debug the
> assertion failure was my first brush with Kaffe sources. Could you take a minute to straighten out
> the following understanding of mine of the gcRealloc()
> function?
> 
> The purpose of the function is to reallocate
> memory, 'mem', to size 'size'. It checks if the
> current size of 'mem', 'osize', is >= 'size' + some
> additional chunk. If it is, it means that 'mem'
> can hold chunk of size 'size' and hence it need
> not reallocate. If 'osize' is < 'size' + sizeof
> (gc_unit), it has to reallocate memory to the 
> requested size, 'size' and not 'osize'. 
> 
> >From your message it seems like I am horribly 
> mistaken in my understanding of the function.

No, that is exactly correct. But in addition realloc
is supposed to not alter the original memory contents,
of which there are "osize" bytes. That is why only
"osize" bytes need to be copied.

The size - osize additional new bytes are just left
uninitialized (actually they'll be zeroed I think).

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com


More information about the kaffe mailing list