flex memory leaks

11 Mar 2000 13:38:48 -0500

          From comp.compilers

Related articles
flex memory leaks nutritioustreat@my-deja.com (2000-03-11)
| List of all articles for this month |

From: nutritioustreat@my-deja.com
Newsgroups: comp.compilers
Date: 11 Mar 2000 13:38:48 -0500
Organization: Deja.com - Before you buy.
Keywords: lex, question, comment


I'M New To Flex/Bison, And In Order To Learn The Basics, I Decided To
Write A .Ini File Parser. Seems To Be Working Fine, Except That In The
Flex-Generated Scanning Code, I Get Memory Leaks - One Of About 16k And
One Of About 40 Bytes. They're Both Happening In yy_create_buffer. How
Do I Get Flex To Free Up This Memory? I Read In A Dusty Faq Somewhere
That Flex Is Good About Cleaning Up After Itself, So I'M Sure I'M Doing
Something Wrong... Or Not Doing Something Altogether... But It Kind Of
Eludes Me. I See That Calling yy_delete_buffer On yy_current_buffer
Might Be Helpful, But I Don't Want To Hack, I Want To Learn How To Do
It The Right Way... Thanks In Advance!

Nutritious Treat
[Look at the generated lexer -- yy_create_buffer allocates a small control
structure and a large data buffer, just as you're seeing. Deleting it
with yy_delete_buffer is indeed the way to free the space. -John]

Post a followup to this message

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