Monday, April 23, 2007

Dealing with Flex generated scanner memory (part 2)

In a previous post, I discussed about my problems with flex scanner's memory. The procedure I was using for manually releasing memory did not seem to be enough since there were still 4 bytes leaking.

Basically, the solution was simpler than I thought: you just need to call

after the lexer finished (for instance, after the call to yyparse()). You can also remove the <> rule (unless you need it to do specific tasks, but not for destroying the scanner!).

This solved all my problems :-)

No comments: