[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
LYNX-DEV wasting of memory
From: |
Hans Reiser |
Subject: |
LYNX-DEV wasting of memory |
Date: |
Fri, 10 Jan 1997 17:02:13 +0200 (MSZ) |
Hello,
I have a problem with lynx V2.6, which leads to unreasonable huge
requirement of memory. I checked the source-code and my first judgment
considers the memory management in the split_line function in GridText.c
to be problematic.
No malloc/free inparity is the problem, but (IMHO) the way the memory is
allocated and realloced. On each time split_line is called, a memory
block is allocated via calloc, and afterwars the block alloced in one call
before is shrunk via realloc. According to my investigation this causes
a memory hole between these two blocks, which is of size
MAXLINESIZE-llength_of_lastbut1_block, and which can't be used in a
subsequent split_line call. Thus, for each line the space of MAXLINESIZE
Bytes is used (with the first part actually really used and the last part
marked free, but unusable for storage of other lines.
This might not be a problems on all systems, if realloc would be
implemented in a way with tries to maximise the free space accordingly
moves a block when reducing its size to a apropriate small memory whole.
But all realloc implementations I just have tested (on hpux9, hpux10,
sunos) behave in the way described above, causing such exhaustive memory
usage.
I tried a hack by doing the realloc _before_ callocing the new memory in
case that 'split' is false (otherwise this would not be possible),
causing the waste of memory only in the rare case of lines being split,
and results seem to work way better than the original to me.
While writing this mail another idea occured to me: Using the RS6000-
realloc-substitute given in the code instead of realloc should IMHO
remove the problem as well, as the calloc call searches for a piece
of memory of the appropriate size.
The main point of this mail is to ask you, if this is a already known
problem of lynx? I came across it while I tried reading a ftp:// - ls-lR
text file of abt. 3MB size, which caused lynx to occupy about 40MB of
main memory (or aborted due to out of memory error on those machines here
which were less splendid filled with memory). What about other
architecutres? I tried HP's, IRIX and Sun's here, all with the same
result.
If this is a already-known-problem, and a patch does exist, I would
appreciate some information where to find it.
If it is not known, migth it be possible to modify lynx in any future
version with a patch like those described by myself or some more
elaborate and improved version of it?
Thank you very much for reading these lines, and also
a big thank-you to all developers of lynx, the web-browser
I do like best of all!
Hansi.
(excuses for my somewhat poor english...)
;
; To UNSUBSCRIBE: Send a mail message to address@hidden
; with "unsubscribe lynx-dev" (without the
; quotation marks) on a line by itself.
;
- LYNX-DEV wasting of memory,
Hans Reiser <=