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.

Submitter:  Rik <rik5>
Submitted:  Thu 22 Dec 2011 08:59:09 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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

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

Rik <rik5>
Group 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>
Group 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>
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>
Group 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.


eval("switch 1 default 1; endswitch")


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:


octave:3> x = eval ('1b*0')
parse error:

  syntax error

>>> 1b*0
     ^

parse error:

  syntax error

>>> 1b*0
    ^


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:


octave:3> x = eval ('0*1b')
parse error:

  syntax error

>>> 0*1b
       ^


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


octave:3> x = eval ('1b+0')
parse error:

  syntax error

>>> 1b+0
     ^


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

This is all very strange.

Rik <rik5>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

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)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-10-12 rik5 StatusNone Fixed
        Open/ClosedOpen Closed
    2013-10-10 rik5 Item GroupPerformance Other
    2012-05-09 rik5 SummaryMemory leak and odd behavior with eval() on development tip Memory leak with eval(STRING) when STRING contains switch and parsing fails.
    2012-04-25 fisheater Attached File- Added bug35154.patch, #25738
    2012-01-09 rik5 Severity4 - Important 3 - Normal
    2011-12-22 rik5 Attached File- Added valgrind.log, #24652

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code