[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Leaks from bison 2.0/Flex 2.5
From: |
Frans Englich |
Subject: |
Leaks from bison 2.0/Flex 2.5 |
Date: |
Sun, 2 Oct 2005 00:54:43 +0000 |
User-agent: |
KMail/1.8.50 |
Hello,
I've managed to get the parser & scanner generated from Bison & Flex to leak
-- and not from my own actions. I don't know whether it is caused by me using
them in a wrong way, or because Flex and/or Bison contains bugs. Below
comments have as background Bison 2.0, Flex 2.5.4, and valgrind 3.0.1.
Simply, the memory leaks are as valgrind reports below. One thing to note is
that the leaks does not originate from the actions, but from Flex & Bison's
other generated code.
I know too little about Flex & Bison in order to be able to comment, but can
provide the information I have and people ask for. All files mentioned in the
valgrind output are available here:
http://websvn.kde.org/branches/work/kdom/xpath/parser/
Note, the generated files are automically renamed; XPathLexer.cpp is
"lex.XPath.c", and XPathParser.cpp is "XPathParser.tab.cpp".
How did I produce this? I ran a test suite with 1127 tests.. I can do a binary
search to narrow down exactly what that triggers, if that turns out to be
needed. However, I know that parsing the expression `"a string"` nor `1`
causes the leaks.
Of course, it can well be that I misuse Flex/Bison. (Comments/suggestions in
general on the grammars are of course appreciated).
Cheers,
Frans
(Note, the leak summary also includes other, unrelated parts that leaks).
==21666== 1725 bytes in 41 blocks are definitely lost in loss record 170 of
202
==21666== at 0x1B8FEA7B: malloc (vg_replace_malloc.c:149)
==21666== by 0x1BB2C225: XPathparse(KXPATH::ParserInformation*)
(XPathParser.tab.cpp:2174)
==21666== by 0x1BB12BA9:
KXPATH::XPathCentral::CreateExpression(KDOM::DOMString const&,
KDOM::SharedPtr<KXPATH::StaticContext> const&,
KXPATH::XPathCentral::LanguageAccent) (XPathCentral.cpp:73)
==21666== by 0x1BBD26ED:
KDOM::XPathExpressionImpl::XPathExpressionImpl(KDOM::DOMString const&,
KDOM::SharedPtr<KXPATH::StaticContext> const&) (XPathExpressionImpl.cpp:47)
==21666== by 0x1BBD3945:
KDOM::XPathEvaluatorImpl::createExpression(KDOM::DOMStringImpl*,
KDOM::XPathNSResolverImpl*) (XPathEvaluatorImpl.cpp:80)
==21666== by 0x804D281:
KXPATH::XPathParserTest::testExpression(KDOM::DOMString const&, bool, bool,
bool) (parser.cpp:135)
==21666== by 0x804CDA8: KXPATH::XPathParserTest::allTests()
(parser.cpp:108)
==21666== by 0x1B908DFC: KUnitTest::Runner::runTest(char const*)
(in /usr/local/kde4/lib/libkunittest.so.0.0.0)
==21666== by 0x1B908BD5: KUnitTest::Runner::runTests()
(in /usr/local/kde4/lib/libkunittest.so.0.0.0)
==21666== by 0x804B80B: main (runtskxpath.cpp:70)
==21666==
==21666==
==21666== 86689 (45560 direct, 41129 indirect) bytes in 1139 blocks are
definitely lost in loss record 197 of 202
==21666== at 0x1B8FEA7B: malloc (vg_replace_malloc.c:149)
==21666== by 0x1BB2F0A9: yy_flex_alloc(unsigned) (lex.XPath.c:2148)
==21666== by 0x1BB2EEAE: XPath_scan_buffer(char*, unsigned)
(lex.XPath.c:1944)
==21666== by 0x1BB2F021: XPath_scan_bytes(char const*, int)
(lex.XPath.c:2007)
==21666== by 0x1BB2EF87: XPath_scan_string(char const*) (lex.XPath.c:1977)
==21666== by 0x1BB12B91:
KXPATH::XPathCentral::CreateExpression(KDOM::DOMString const&,
KDOM::SharedPtr<KXPATH::StaticContext> const&,
KXPATH::XPathCentral::LanguageAccent) (XPathCentral.cpp:66)
==21666== by 0x1BBD26ED:
KDOM::XPathExpressionImpl::XPathExpressionImpl(KDOM::DOMString const&,
KDOM::SharedPtr<KXPATH::StaticContext> const&) (XPathExpressionImpl.cpp:47)
==21666== by 0x1BBD3945:
KDOM::XPathEvaluatorImpl::createExpression(KDOM::DOMStringImpl*,
KDOM::XPathNSResolverImpl*) (XPathEvaluatorImpl.cpp:80)
==21666== by 0x804D281:
KXPATH::XPathParserTest::testExpression(KDOM::DOMString const&, bool, bool,
bool) (parser.cpp:135)
==21666== by 0x804CDA8: KXPATH::XPathParserTest::allTests()
(parser.cpp:108)
==21666== by 0x1B908DFC: KUnitTest::Runner::runTest(char const*)
(in /usr/local/kde4/lib/libkunittest.so.0.0.0)
==21666== by 0x1B908BD5: KUnitTest::Runner::runTests()
(in /usr/local/kde4/lib/libkunittest.so.0.0.0)
==21666==
==21666== LEAK SUMMARY:
==21666== definitely lost: 47473 bytes in 1188 blocks.
==21666== indirectly lost: 56299 bytes in 1898 blocks.
==21666== possibly lost: 0 bytes in 0 blocks.
==21666== still reachable: 861924 bytes in 17278 blocks.
==21666== suppressed: 0 bytes in 0 blocks.
==21666== Reachable blocks (those to which a pointer was found) are not shown.
- Leaks from bison 2.0/Flex 2.5,
Frans Englich <=