[Dev-luatex] Some suggestion for dynamic allocation...
dak at gnu.org
Tue May 29 10:20:47 CEST 2007
I have seen in the recent ChangeLogs code changes that basically do a
realloc of array structures and stuff. realloc with a fixed increment
is basically O(n^2) (it becomes O(n) for a fixed growth percentage).
Anyway, I seem to remember that the basic Pascal compiler implemented
by web2c actually _has_ new, delete, and pointer types.
Maybe it would be saner to just scrap the array indexing stuff and
replace it with the normal dynamic allocation that the libraries are
There is going to be some amount of waste since new/delete are mapped
to malloc/free, and those store the size of the allocated block before
it, while Pascal has the required size information available at the
time it calls delete.
However, I think that the resulting memory bloat might likely be
offset by the advantages of using a more "native" memory access model
that tends to be better matched to the operating system and its
The main problem I see is dealing with dumping a format, since then
the memory is indeed being accessed as a sequential array.
More information about the dev-luatex