bugGNU Octave - Bugs: bug #35154, Memory leak with eval(STRING) when...


bug #35154: Memory leak with eval(STRING) when STRING contains switch and parsing fails.

Submitted by:  Rik <rik5>
Submitted on:  Thu Dec 22 20:59:09 2011  
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Other
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Sat Oct 12 22:59:28 2013, comment #4:

This has been fixed by jwe in this changeset 17632:bd0a84de3375.

Rik <rik5>
Project Administrator
Wed May 9 03:51:54 2012, comment #3:

Incidentally, I applied your patch to the development branch about two weeks ago (http://hg.savannah.gnu.org/hgweb/octave/rev/3a10d5bdada8). I have re-titled this bug report.

Rik <rik5>
Project Administrator
Wed Apr 25 20:19:09 2012, comment #2:

The extraneous output is due to the fact that ABORT_PARSE returns YYACCEPT on a parse error in interactive mode, but eval_string expects YYABORT. I have attached a patch that fixes this issue.

The memory leak appears to be unrelated.

(file #25738)

Max Brister <fisheater>
Project Member
Mon Jan 9 19:08:38 2012, comment #1:

I'm dropping the bug priority below 4 so this will no longer be a blocker for the 3.6.0 release.

Rik <rik5>
Project Administrator
Thu Dec 22 20:59:09 2011, original submission:

I've discovered some odd behavior with eval().

First, there is a memory leak caught by valgrind with this simple code.

I have attached the valgrind log.

The second issue, which may be related to the memory leak, is that eval() appears to evaluate the code twice if an error condition is found.

For example:

This looks to be related to parsing because it depends on the operation involved (+,-,/,*) and whether it is the final parse unit which returns an error.

More sample code:

In this case there is only one parse error when the problem parse unit comes second. Similarly,

displays only one error because the operation has been changed from '*' to '+'.

This is all very strange.

Rik <rik5>
Project Administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #25738:  bug35154.patch added by fisheater (689B - text/x-patch)
file #24652:  valgrind.log added by rik5 (37kB - text/x-log)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by fisheater (Updated the item)
  • -unavailable- added by rik5 (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat Oct 12 22:59:28 2013rik5StatusNone=>Fixed
    Thu Oct 10 19:44:08 2013rik5Item GroupPerformance=>Other
    Wed May 9 03:51:54 2012rik5SummaryMemory leak and odd behavior with eval() on development tip=>Memory leak with eval(STRING) when STRING contains switch and parsing fails.
    Wed Apr 25 20:19:09 2012fisheaterAttached File-=>Added bug35154.patch, #25738
    Mon Jan 9 19:08:38 2012rik5Severity4 - Important=>3 - Normal
    Thu Dec 22 20:59:09 2011rik5Attached File-=>Added valgrind.log, #24652

    Back to the top

    Powered by Savane 3.1-cleanup1