lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Julien Cugniere wrote:
> Edgar Toernig wrote:
> > I found the problem.  At least here it's a bug in realloc(x,0).  It's
> > not an alias for free(x).  It truncates x to a fixed small size (and
> > even returns that address).  Of course, that will prohibit any defrag-
> > mentation.  Replacing the freeing l_realloc in lmem.c by a free(block)
> > cures the problem.
> I confirm that this solves the problem for me too, both on djgpp (gcc 2.95.2)
> and mingw32 (gcc 3.2). Thanks a lot!
> Julien Cugniere

On my linux 2.2.10 system, with a from 1999, the 
example Edgar Toernig gave worked fine. Apparently, this is 
an issue of realloc(x,0) not working in the same way under 
different C library implementations. 

I do not know what the ANSI C standard says about using 
realloc(x,0). Is it allowed according to the standard to 
use realloc to free memory? Or is it something undefined 
or non-canonical? I would have thought that the latter is 
the case...

"No one knows true heroes, for they speak not of their greatness." -- 
Daniel Remar.
Björn De Meyer