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 22 Dec 2011 08:59:09 PM UTC  
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 Markup)

You are not logged in

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


Sat 12 Oct 2013 10:59:28 PM UTC, comment #4:

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

Rik <rik5>
Project Administrator
Wed 09 May 2012 03:51:54 AM UTC, 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 25 Apr 2012 08:19:09 PM UTC, 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 09 Jan 2012 07:08:38 PM UTC, 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 22 Dec 2011 08:59:09 PM UTC, 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 (37KiB - text/x-log)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by fisheater (Updated the item)
  • -email is 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 12 Oct 2013 10:59:28 PM UTCrik5StatusNone=>Fixed
    Thu 10 Oct 2013 07:44:08 PM UTCrik5Item GroupPerformance=>Other
    Wed 09 May 2012 03:51:54 AM UTCrik5SummaryMemory leak and odd behavior with eval() on development tip=>Memory leak with eval(STRING) when STRING contains switch and parsing fails.
    Wed 25 Apr 2012 08:19:09 PM UTCfisheaterAttached File-=>Added bug35154.patch, #25738
    Mon 09 Jan 2012 07:08:38 PM UTCrik5Severity4 - Important=>3 - Normal
    Thu 22 Dec 2011 08:59:09 PM UTCrik5Attached File-=>Added valgrind.log, #24652

    Back to the top

    Powered by Savane 3.1-cleanup1