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

Re: Realloc is blocking execution

onsdag den 14 oktober 2009 klockan 13:54 skrev ERSEK Laszlo detta:
> On Wed, 14 Oct 2009, Goswin von Brederlow wrote:
> >Mats Erik Andersson <mats.andersson@gisladisker.se> writes:
> >
> >>Is this unavoidable fact that realloc() blocks execution
> >>a known issue with gcc-4.3.2 or glibc-2.7?
> >>Personally, I was under the impression that
> >>malloc/realloc never should block execution,
> >>but would instead return NULL. That Etch and
> >>Lenny behave oppositely disturbs me very much.
> >
> >What do you mean by "block execution"?
> >
> >If you mean it takes a while to return then I guess that just means
> >you now have a case where memory is copied while before there was free
> >space after the allocation.
> I suppose even massive memory copying and/or swap activity would hardly 
> delay the gcc process so much that it would be distinguishable from 
> "normal" gcc behavior. Perhaps Mats means "the gcc process hangs 
> indefinitely in realloc()"?
> Mats, how do you know it's realloc()? Can you try "strace gcc"?
> Cheers,
> lacos

I inserted two printouts, immediately surrounding realloc():

        fprintf(stderr, "Will enter realloc().\n");

	ptr = realloc(ptrold, 1024)

	fprintf(stderr, "Has exited realloc().\n");

Only the first statement gets printed. In addition, the machine
I run the test on, has 1 GB physical memory, yet refuses to reallocate
a meager 1 kB. I am the sole user on the system, execept for the few
background services I use to test the programs I develop.
The inability to release 1 kB memory for usage made me wondering about bugs.


Mats Erik Andersson, fil. dr

Reply to: