[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lynx-dev Lynx problems
From: |
Leonid Pauzner |
Subject: |
Re: lynx-dev Lynx problems |
Date: |
Wed, 19 Feb 2003 16:18:08 +0300 (MSK) |
18-Feb-2003 22:41 Ilya Zakharevich wrote:
> a) HText_RemovePreviousLine() does not return the previous line to the pool;
> is not this a leak?
This is a feature.
Pools only growth. We cannot return memory back to the pool (*).
Anyway, this function is called when the previous line is nearly empty
(spaces or control characters only) so the waste of memory seems minimal.
There are other functions, insert_blank_in_lines() calls comes in mind.
The pool freed in HText_free(), until then the memory in question is
allocated but not used. (Who care about a couple of bytes?)
(*) This is a stack, so in theory we can undo the last allocation operation:
we should check if this is the last, and store the size of the last
allocation somethere. We can implement this easily. Not sure this returns
something in real cases.
--- gridtext.12d 2003-01-02 12:39:02.000000000 +0000
+++ gridtext.new 2003-01-02 13:28:46.000000000 +0000
@@ -3233,6 +3255,8 @@ PRIVATE void split_line ARGS2(
previous->next->prev = jline;
previous->prev->next = jline;
+ POOLfreeHTLine(previous);
+
previous = jline;
}
{ /* (ht_num_runs==1) */
@@ -4510,6 +4534,7 @@ PRIVATE int HText_insertBlanksInStblLine
lines_changed++;
if (line == first_line)
first_line = mod_line;
+ POOLfreeHTLine(line);
line = mod_line;
#ifdef DISP_PARTIAL
/*
@@ -5520,6 +5545,7 @@ PUBLIC void HText_endAppend ARGS1(
*/
next_to_the_last_line->next = line_ptr;
line_ptr->prev = next_to_the_last_line;
+ POOLfreeHTLine(text->last_line);
text->last_line = next_to_the_last_line;
text->Lines--;
CTRACE((tfp, "GridText: New bottom line: `%s'\n",
@@ -8516,6 +8542,7 @@ PUBLIC void HText_RemovePreviousLine ARG
previous->next = text->last_line;
text->last_line->prev = previous;
text->Lines--;
+ POOLfreeHTLine(line);
}
/*
; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden