Re: Memory leak in flex generated file

commander <jnvolkov@gmail.com>
Tue, 21 Aug 2007 01:09:52 -0700

          From comp.compilers

Related articles
[4 earlier articles]
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)
Re: Memory leak in flex generated file johnmillaway@yahoo.com (John Millaway) (2005-10-29)
Memory leak in flex generated file pierreir@look.ca (Pierre Innocent) (2007-08-20)
Re: Memory leak in flex generated file jnvolkov@gmail.com (commander) (2007-08-21)
| List of all articles for this month |

From: commander <jnvolkov@gmail.com>
Newsgroups: comp.compilers
Date: Tue, 21 Aug 2007 01:09:52 -0700
Organization: Compilers Central
References: 07-08-059
Keywords: lex, storage

> I came across with essentially the same problem.
> Here is a section of the valgrind log:
>
> ==17231==
> ==17231== 2,371,104 (11,472 direct, 2,359,632 indirect) bytes in 239
> blocks are definitely lost in loss record 51 of 66
> ==17231== at 0x401C627: malloc (vg_replace_malloc.c:149)
> ==17231== by 0x80F3842: indexeralloc(unsigned) (lex.indexer.c:17657)
> ==17231== by 0x80F4041: indexer_create_buffer(_IO_FILE*, int)
> (lex.indexer.c:17186)
> ==17231== by 0x80F40FD: indexerrestart(_IO_FILE*) (lex.indexer.c:17126)
> ==17231== by 0x80F9128: Indexer::scanFile(String const&, uint32_t)
> (indexer.cc:1068)
> ==17231== by 0x81096A6: main (indexer.cc:2542)
> ==17231==
> ==17231==
> ==17231== 1,573,152 bytes in 98 blocks are possibly lost in loss record
> 65 of 66
> ==17231== at 0x401C627: malloc (vg_replace_malloc.c:149)
> ==17231== by 0x80F3842: indexeralloc(unsigned) (lex.indexer.c:17657)
> ==17231== by 0x80F4072: indexer_create_buffer(_IO_FILE*, int)
> (lex.indexer.c:17195)
> ==17231== by 0x80F40FD: indexerrestart(_IO_FILE*) (lex.indexer.c:17126)
> ==17231== by 0x80F9128: Indexer::scanFile(String const&, uint32_t)
> (indexer.cc:1068)
> ==17231== by 0x81096A6: main (indexer.cc:2542)
> ==17231==
> ==17231== LEAK SUMMARY:
> ==17231== definitely lost: 11,532 bytes in 241 blocks.
> ==17231== indirectly lost: 2,360,292 bytes in 161 blocks.
> ==17231== possibly lost: 1,678,544 bytes in 570 blocks.
> ==17231== still reachable: 1,688,164 bytes in 4,486 blocks.
> ==17231== suppressed: 0 bytes in 0 blocks.
> ==17231== Reachable blocks (those to which a pointer was found) are not
> shown.
> ==17231== To see them, rerun with: --leak-check=full --show-reachable=yes


what is your flex version? what language (C or C++) the generated
scanner is? for C++ I suggested the solution here


http://sourceforge.net/mailarchive/forum.php?thread_name=207941110.1170153705.161019936.16611%40mcgi25.rambler.ru&forum_name=flex-help


For C based scanner you should invoke yy_destroy_buffer as far as I
remember.


Regards.
Yuriy



Post a followup to this message

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