[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[8377] parsetexi update and fix memory leak
From: |
gavinsmith0123 |
Subject: |
[8377] parsetexi update and fix memory leak |
Date: |
Mon, 22 Oct 2018 16:53:31 -0400 (EDT) |
Revision: 8377
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8377
Author: gavin
Date: 2018-10-22 16:53:31 -0400 (Mon, 22 Oct 2018)
Log Message:
-----------
parsetexi update and fix memory leak
Modified Paths:
--------------
trunk/tp/Texinfo/XS/parsetexi/README
trunk/tp/Texinfo/XS/parsetexi/end_line.c
trunk/tp/Texinfo/XS/parsetexi/handle_commands.c
trunk/tp/Texinfo/XS/parsetexi/parser.c
Modified: trunk/tp/Texinfo/XS/parsetexi/README
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/README 2018-10-22 17:20:31 UTC (rev
8376)
+++ trunk/tp/Texinfo/XS/parsetexi/README 2018-10-22 20:53:31 UTC (rev
8377)
@@ -30,12 +30,31 @@
=====================================================================
-Can compare execution runs of parsetexi and Perl makeinfo with
+To see contents of leaked memory
-makeinfo -C DEBUG=1 node_structure.texi |& less
+Run with valgrind, e.g.
-vs.
+s=../../tp
+export srcdir=$s builddir=. top_srcdir=../../ top_builddir=..
+export TEXINFO_XS_PARSER=1
+valgrind --leak-check=full --vgdb-error=0 --vgdb-stop-at=exit \
+ perl -w $s/t/18itemize.t
-./parsetexi node_structure.texi |& less
+at end of run, in gdb:
+(gdb) monitor leak_check definiteleak any
+==10409== 480 (80 direct, 400 indirect) bytes in 1 blocks are definitely lost
in loss record 3,261 of 4,374
+...
+
+(gbd) monitor block_list 3261
+
+
+Get log files specific to tests with
+
+$ grep '^\['\' $s/t/18itemize.t | sed -e 's/^..//' -e 's/..$//' >test-list
+$ for t in `cat test-list` ; do valgrind --log-file=val.log.$t \
+--leak-check=full perl -w $s/t/18itemize.t $t ; done
+
+
+
Modified: trunk/tp/Texinfo/XS/parsetexi/end_line.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/end_line.c 2018-10-22 17:20:31 UTC (rev
8376)
+++ trunk/tp/Texinfo/XS/parsetexi/end_line.c 2018-10-22 20:53:31 UTC (rev
8377)
@@ -1784,23 +1784,16 @@
/* This closes tree elements (e.g. paragraphs) until we reach
end_command. It can print an error if another block command
is found first. */
- current = close_commands (current, end_id,
- &closed_command, 0); /* 3292 */
+ current = close_commands (current, end_id, &closed_command, 0);
if (!closed_command)
+ destroy_element_and_children (end_elt);
+ else
{
- /* shouldn't get here, but got here
- on 2015.11.30 for t/16raw.t */
- //FIXME abort (); // 3335
- }
- else
- { // 3295
- // FIXME: end_elt correct?
add_extra_element (closed_command, "end_command", end_elt);
close_command_cleanup (closed_command);
- add_to_element_contents (closed_command, end_elt); // 3321
+ add_to_element_contents (closed_command, end_elt);
- // 3324 ET_menu_comment
if (command_flags(closed_command) & CF_menu
&& current_context () == ct_menu)
{
Modified: trunk/tp/Texinfo/XS/parsetexi/handle_commands.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/handle_commands.c 2018-10-22 17:20:31 UTC
(rev 8376)
+++ trunk/tp/Texinfo/XS/parsetexi/handle_commands.c 2018-10-22 20:53:31 UTC
(rev 8377)
@@ -89,6 +89,7 @@
char *line = *line_inout;
int arg_spec;
+ *status = 0;
arg_spec = command_data(cmd).data;
if (arg_spec == OTHER_noarg)
{
Modified: trunk/tp/Texinfo/XS/parsetexi/parser.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/parser.c 2018-10-22 17:20:31 UTC (rev
8376)
+++ trunk/tp/Texinfo/XS/parsetexi/parser.c 2018-10-22 20:53:31 UTC (rev
8377)
@@ -1702,16 +1702,16 @@
{
int status;
current = handle_other_command (current, &line, cmd, &status);
- if (status == 1)
- {
- retval = GET_A_NEW_LINE;
- goto funexit;
- }
- else if (status == 2)
- {
- retval = FINISHED_TOTALLY;
- goto funexit;
- }
+ if (status == 1)
+ {
+ retval = GET_A_NEW_LINE;
+ goto funexit;
+ }
+ else if (status == 2)
+ {
+ retval = FINISHED_TOTALLY;
+ goto funexit;
+ }
}
else if (command_data(cmd).flags & CF_line)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [8377] parsetexi update and fix memory leak,
gavinsmith0123 <=