bugGNU Octave - Bugs: bug #40230, Memory leak in putenv

 
 

bug #40230: Memory leak in putenv

Submitted by:  Rik <rik5>
Submitted on:  Thu 10 Oct 2013 02:48:08 AM 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.

 

Thu 10 Oct 2013 08:17:47 PM UTC, comment #4:

This is enough of a fix for me, closing report.

Rik <rik5>
Project Administrator
Thu 10 Oct 2013 06:36:42 PM UTC, comment #3:

For the record, this remaining strange behavior is probably due to exec() failing in a documented way because of the size of the environment. Octave could attempt to put a cap on the total size of the environment, but I'd call that one out of scope.

For comparison, here's a bash command line that gives the error that you're probably seeing with the pager:

Mike Miller <mtmiller>
Project Administrator
Thu 10 Oct 2013 06:02:01 PM UTC, comment #2:

I checked in the following changeset.

http://hg.savannah.gnu.org/hgweb/octave/rev/7b305b36b87e

It probably doesn't fix the memory leak problem (the memory is still allocated and stored in the environment and not explicitly deallocated before program exit) but it should prevent Octave's memory usage from growing without bound for things like

However, I did still notice some strange behavior if I ran the above and attempted to put a very large string (8MB) in the environment. For example, after running the code above with N set to 1024*1024, the pager quit working correctly. But that appears to happen even when making the putenv call just once with such a large string...

Rik, I'm not sure whether we should mark this "fixed" or not, but I think we might as well close the report. If you agree, please close it.

John W. Eaton <jwe>
Project Administrator
Thu 10 Oct 2013 01:48:57 PM UTC, comment #1:

I'm not sure there is much we can do here. As I read the documentation, the strings become part of the environment and so can't be freed.

Rik <rik5>
Project Administrator
Thu 10 Oct 2013 02:48:08 AM UTC, original submission:

The following Octave code:

produces the following leak report. I've verified that the loss is always the C-terminated strings "VAR" and "VAL" which are the inputs to putenv. When it is not a trivial example, such as when EXEC_PATH is set, the loss is more like 700 bytes.

Rik <rik5>
Project Administrator

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 10 Oct 2013 08:17:47 PM UTCrik5StatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1