Re: Memory leak in flex generated file

haberg@math.su.se (Hans Aberg)
23 Oct 2005 00:34:03 -0400

          From comp.compilers

Related articles
Memory leak in flex generated file pavel.orehov@gmail.com (pavel.orehov@gmail.com) (2005-10-20)
Re: Memory leak in flex generated file haberg@math.su.se (2005-10-23)
Re: Memory leak in flex generated file gneuner2@comcast.net (George Neuner) (2005-10-23)
Re: Memory leak in flex generated file johnmillaway@yahoo.com (John Millaway) (2005-10-26)
Re: Memory leak in flex generated file Markus.Elfring@web.de (2005-10-26)
Re: Memory leak in flex generated file haberg@math.su.se (2005-10-27)
Re: Memory leak in flex generated file haberg@math.su.se (2005-10-27)
Re: Memory leak in flex generated file johnmillaway@yahoo.com (John Millaway) (2005-10-27)
[3 later articles]
| List of all articles for this month |

From: haberg@math.su.se (Hans Aberg)
Newsgroups: comp.compilers
Date: 23 Oct 2005 00:34:03 -0400
Organization: Mathematics
References: 05-10-140
Keywords: lex
Posted-Date: 23 Oct 2005 00:34:03 EDT

  "pavel.orehov@gmail.com" <pavel.orehov@gmail.com> wrote:


> I did not found flex/bison group, so i put it here.


>From the headers of these mailing lists.


        List-Id: "Users list for Flex, the GNU lexical analyser generator"
<help-flex.gnu.org>
        List-Unsubscribe:
<http://lists.gnu.org/mailman/listinfo/help-flex>,
<mailto:help-flex-request@gnu.org?subject=unsubscribe>
        List-Archive: <http://lists.gnu.org/pipermail/help-flex>
        List-Post: <mailto:help-flex@gnu.org>
        List-Help: <mailto:help-flex-request@gnu.org?subject=help>
        List-Subscribe: <http://lists.gnu.org/mailman/listinfo/help-flex>,
<mailto:help-flex-request@gnu.org?


List-Id: Users list for the GNU Bison parser generator <help-bison.gnu.org>
      List-Unsubscribe:
<http://lists.gnu.org/mailman/listinfo/help-bison>,
<mailto:help-bison-request@gnu.org?subject=unsubscribe>
      List-Archive: <http://lists.gnu.org/pipermail/help-bison>
      List-Post: <mailto:help-bison@gnu.org>
      List-Help: <mailto:help-bison-request@gnu.org?subject=help>
      List-Subscribe: <http://lists.gnu.org/mailman/listinfo/help-bison>,
<mailto:help-bison-request@gnu.org?subject=subscribe>


> I am using flex and bison to parse HTTP headers. After some
> investigation i found a memory leak in flex generated file with
> valgrind tool.
>
> Does anybody meet this leak problem or i am a bad user ?
....
> [I think it's deliberate. If you look at the code, it allocates a state
stack and never
> frees it. Since the state stack is rarely large and is reused on
subsequent runs, it's
> not a big deal. -John]


This indeed one of the memory leak problems. The Flex generated lexer also
allocates an input buffer, I think might leak. In addition, the Bison
generated parser currently leaks error message strings.


--
    Hans Aberg


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.