[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
requesting feedback: memory management in flex
From: |
John W. Millaway |
Subject: |
requesting feedback: memory management in flex |
Date: |
Tue, 26 Mar 2002 11:07:56 -0800 (PST) |
One of the items on the TODO list for flex is to allow the programmer to
specify exactly HOW and WHEN flex allocates memory.
Currently, flex allocates a 16k+40b buffer in the first call to yylex(), then
realloc's memory as needed, by doubling the size of the buffer each time. On
the first call to yy_push_state, flex allocates 25*sizeof(int) bytes for the
stack when using scanner states. The stack is realloc'd as needed in constant
chunks of 25*sizeof(int).
There is no documented API to free the 16k+ buffer in plain flex (but you can
free it in the C++ scanners and reentrant C scanners.)
I'm requesting suggestions for things you would like to do with flex, but that
are not currently easy to do because of the way flex handles memory.
The obvious ones are:
* Ability to override the amount of memory alloc'd and realloc'd.
* Ability to enforce an upper bound on the buffer sizes, with error handling.
* Ability to override the default alloc/realloc/free functions.
* Ability to free the 16k+ input buffer in traditional flex (non-reentrant C
scanner).
Any other suggestions?
__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- requesting feedback: memory management in flex,
John W. Millaway <=