Re: out-of-mem handler



On 14 Feb 2000, Havoc Pennington wrote:

> > you are aware, that you need to do similar things at the malloc level
> > as well then, to prevent it from failing in xlib etc., right?
> > 
> 
> Yes, I know. I think even if you can't do this however, recovering
> successfully some percentage of the time (when mem is exhausted in
> glib) is still an improvement.

that's just a random game, you try to put some questionable handling
for *some* case where a rare error could take effect. the point is,
you either need to do this for libc as well or not do anything at all.
and if you're up to the point where you alter the malloc/free/realloc
functionality at libc level, you don't need further handling in
glib anyways, since that juast calls libc's malloc/realloc/free anyways.

on a side note, calling sleep() from whithin malloc() may not even
necessarily produce sane results, e.g. for code that does something
like gettimeofday(&tv,&tz), malloc(), evaluate tv or tz (this could
for instance happen in the main loop). or imagine server grabs are
being held during your malloc sleep etc., there are probably a lot
of else situations where you'd rather bail than sleep.

> 
> Havoc
> 

---
ciaoTJ



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