-
Damien George authored
There are 2 locations in parser, and 1 in compiler, where memory allocation is not precise. In the parser it's the rule stack and result stack, in the compiler it's the array for the identifiers in the current scope. All other mallocs are exact (ie they don't allocate more than is needed). This patch adds tuning options (MP_ALLOC_*) to mpconfig.h for these 3 inexact allocations. The inexact allocations in the parser should actually be close to logarithmic: you need an exponentially larger script (absent pathological cases) to use up more room on the rule and result stacks. As such, the default allocation policy for these is now to start with a modest sized stack, but grow only in small increments. For the identifier arrays in the compiler, these now start out quite small (4 entries, since most functions don't have that many ids), and grow incrementally by 6 (since if you have more ids than 4, you probably have quite a few more, but it wouldn't be exponentially more). Partially addresses issue #560.
66e18f04