Re: [Flex-help] memory leaks even after yy_delete_buffer(YY_CURRENT_BUFFER)
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Lorenzo B. <be...@ds...> - 2007-03-23 10:00:43
|
Hi Paul as far as I understand this patch is for C++ scanner, while in my case it's a C scanner, or am I missing something? thanks Lore Paul Swoboda wrote: > Hey Lorenzo, > > "Yuri" sent me this, and it cured that exact leak nicely: > > ----------------------------- > > That is true! I've submited that in > http://sourceforge.net/mailarchive/forum.php?thread_id=31561058&forum_id=39108 > <http://sourceforge.net/mailarchive/forum.php?thread_id=31561058&forum_id=39108>. > You should edit the file flex.skl to add missing string and recompile > your copy of flex. > > ----------------------------- > > Regards, > > Paul > > > On 3/23/07, *Lorenzo Bettini* <be...@ds... > <mailto:be...@ds...>> wrote: > > Hi > > I'm using flex version 2.5.31 and I was experiencing some memory leaks > (using valgrind); actually they were still reachable bytes (16438 > bytes). > > After checking the manual, > http://flex.sourceforge.net/manual/Memory-leak-_002d-16386-bytes-allocated-by-malloc_002e.html#Memory-leak-_002d-16386-bytes-allocated-by-malloc_002e > <http://flex.sourceforge.net/manual/Memory-leak-_002d-16386-bytes-allocated-by-malloc_002e.html#Memory-leak-_002d-16386-bytes-allocated-by-malloc_002e> > > I added this rule in the scanner > > <<EOF>> { > /* For non-reentrant C scanner only. */ > yy_delete_buffer(YY_CURRENT_BUFFER); > > yyterminate(); > } > > however, there are still 4 bytes still reachable: > > ==31245== 4 bytes in 1 blocks are still reachable in loss record 1 of 3 > ==31245== at 0x4021618: malloc (in > /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so) > ==31245== by 0x8069B72: stylesc_alloc(unsigned) ( > stylescanner.cc:1909) > ==31245== by 0x8069BED: stylesc_ensure_buffer_stack() > (stylescanner.cc:1646) > ==31245== by 0x806A98B: stylesc_lex() (stylescanner.cc:753) > ==31245== by 0x8066F67: stylesc_parse() ( styleparser.cc:1344) > ==31245== by 0x8067F60: parseStyles(std::string const&, std::string > const&) (styleparser.yy:177) > ==31245== by 0x80505FB: StartApp::start(int, char**) > (startapp.cc:300) > ==31245== by 0x8055892: main ( source-highlight.cc:26) > > am I still missing something? > -- Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze ICQ# lbetto, 16080134 (GNU/Linux User # 158233) HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com http://www.gnu.org/software/src-highlite http://www.gnu.org/software/gengetopt http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net |