[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Fri, 20 Oct 2023 16:46:29 -0400 (EDT) |
branch: master
commit 2e402c9aab9c8a604bc631c98bc403e8ac156594
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Oct 20 22:44:50 2023 +0200
* tp/Texinfo/XS/main/tree.c (spare_element, reset_obstacks)
(new_element, destroy_element): comment out code related to
spare_element. Instead simply free the destroyed element.
Avoiding memory leak with spare_element requires calling
reset_obstacks, which adds some complexity.
---
ChangeLog | 8 ++++++++
tp/Texinfo/XS/main/tree.c | 13 ++++++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index acf54a2cfd..7af248af5b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-10-19 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/tree.c (spare_element, reset_obstacks)
+ (new_element, destroy_element): comment out code related to
+ spare_element. Instead simply free the destroyed element.
+ Avoiding memory leak with spare_element requires calling
+ reset_obstacks, which adds some complexity.
+
2023-10-19 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/convert_html.c
diff --git a/tp/Texinfo/XS/main/tree.c b/tp/Texinfo/XS/main/tree.c
index 8f6bdd7f92..2f82095409 100644
--- a/tp/Texinfo/XS/main/tree.c
+++ b/tp/Texinfo/XS/main/tree.c
@@ -54,17 +54,20 @@ static int *obs_element_first = 0;
/* Used with destroy_element to reuse storage, e.g. from
abort_empty_line. Reduces memory use slightly (about 5% from testing)
for large manuals. */
+/*
static ELEMENT *spare_element;
+*/
void
reset_obstacks (void)
{
/* freed in reset_obstacks */
+ /*
if (spare_element)
free (spare_element);
spare_element = 0;
-
+ */
/* obstacks not used
if (obs_element_first)
@@ -92,6 +95,7 @@ new_element (enum element_type type)
{
ELEMENT *e;
+ /*
if (spare_element)
{
e = spare_element;
@@ -100,10 +104,13 @@ new_element (enum element_type type)
}
else
{
+ */
e = alloc_element ();
/* alloc_element zeroes *e. We assume null pointers have bit
representation of all zeroes. */
+ /*
}
+ */
e->type = type;
@@ -179,11 +186,15 @@ destroy_element (ELEMENT *e)
destroy_associated_info (&e->extra_info);
destroy_associated_info (&e->info_info);
+ free (e);
+
/* freed in reset_obstacks */
+ /*
if (spare_element)
free (spare_element);
spare_element = e;
+ */
}
/* Recursively destroy this element and all data in its descendants. */