[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: out of memory
- From: Edgar Toernig <froese@...>
- Date: Sat, 05 Oct 2002 07:17:37 +0200
Edgar Toernig wrote:
> Something's fishy! I got the problem too (x86-linux libc5).
> lua5 -e 's="" for i=1,10000 do s=s.."x" end'
> grows to >40MB (100000 is too much for my system) with only 200kb in
> actual use (reported by mallinfo). It seems, the heap is totally
> fragmented with realloc unable to reuse anything at all (but nblocks
> seems to be right!).
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.