UPDATED 2002-07-10: As of
flex version 2.5.9, this leak means that you did not
yylex_destroy(). If you are using an earlier version of
flex, then read
The leak is about 16426 bytes. That is, (8192 * 2 + 2) for the read-buffer, and
about 40 for
struct yy_buffer_state (depending upon alignment). The leak is in
the non-reentrant C scanner only (NOT in the reentrant scanner, NOT in the C++
flex doesn’t know when you are done, the buffer is never freed.
However, the leak won’t multiply since the buffer is reused no matter how many
times you call
If you want to reclaim the memory when you are completely done scanning, then you might try this:
/* For non-reentrant C scanner only. */ yy_delete_buffer(YY_CURRENT_BUFFER); yy_init = 1;
yy_init is an "internal variable", and hasn’t been tested in this
situation. It is possible that some other globals may need resetting as well.