lynx-dev
[Top][All Lists]
Advanced

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

Re: lynx-dev outofmem() allocating memory


From: Klaus Weide
Subject: Re: lynx-dev outofmem() allocating memory
Date: Wed, 7 Apr 1999 07:16:28 -0500 (CDT)

On Mon, 5 Apr 1999, Gisle Vanem wrote:

> Lynx 2.8.2.dev21, djgpp 2.02 (DOS) version.
>  
> While building Lynx with a great new mallocing debugger (YAMD),
> I found that `outotmem()' indirectly tries to allocate another 16kB !
>  
> This contradiction happens in libc's `fflush (stdout)'; it doesn't
> happen while in `fflush(stderr)' (because stdout is line-buffered).

Except that *stderr isn't really the library-provided FILE you would
expect, if a Trace Log file is in use.  So you may have that problem
even for stderr.

> It also happens if `printf()' contains a '\n'.
>  
> I think this behavior is same under other POSIX compliant targets;
> It makes sense to me that `fflush(stdout)' should flush it's buffer
> and allocate another.
>  
> I suggest that when `LYOutOfMemory' is true, flushing should not
> be done. Alternatively, we should use non-buffered `write()' or
> print to `stderr'.

There all kinds of things that may happen after outofmem() is called.
Several of those could potentially allocate memory, for example
termination of curses mode.  Instead of checking all of those possible
calls, it seems more reasonambe to provide an option to make
outofmem() do an abort() immediately.  Maybe after printing where
the outofmem condition occurred, but that may already involve
allocation of a buffer...

Alternatively, outofmem() could try to do some of the cleanups that
free memory first, before doing anything else.  Then there should be
at least enough memory available for stdio purposes.  Too bad that
memory cleanup has just been disabled in recent patches!

But if you seriously want to debug memory problems, you probably
want to disable the various things that can happen in outofmem()
anyway, and instead replace outpofmem() with something more
straightforward.

> BTW. YAMD (Yet Another Mallocing Debugger) is for djgpp and Linux.
>      It's available at <http://www.cartsys.com/eldredge/n/yamd/>

For the purposes of debugging lynx, how does it compare to lynx's
very own '--enable-find-leaks'?

    Klaus


reply via email to

[Prev in Thread] Current Thread [Next in Thread]