-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Hi @Blake-Madden,
I'm working with the library on an embedded system and running into RAM usage issues. I’m looking for guidance on whether to submit feature requests or pursue internal customizations to reduce memory consumption.
Context
- System constraints: Embedded environment with limited memory
- Usage pattern:
- ~100 simultaneous pre-compiled expressions (
te_parserinstances) - Most expressions are simple (often just a single variable)
- Each expression is initialized with ~50 variables (each typically uses only 1–2, but it's not known in advance which ones)
- ~100 simultaneous pre-compiled expressions (
I’m already using TE_NO_BOOKKEEPING, but I’m still seeing significant heap usage. My current assumption is that much of this comes from storing variable names (in m_customFuncsAndVars and possibly elsewhere). For example:
100 expressions × 50 variables × ~8 bytes per name = ~40 KB of heap used for variable names alone
Questions
-
Is this analysis accurate?
Are all variable names stored for each expression, regardless of usage? Are those names still needed for evaluation after compilation? -
Can variable names be freed after compilation?
I tried callingexpression.set_variables_and_functions({})post-compilation, but then of course evaluation fails as this removes allte_variableinstances, not only names. -
Is there a way to remove unused variables post-compilation?
I'm considering enabling bookkeeping, then usingis_function_used()andremove_variable_or_function()to prune unused variables after compilation. Is this a viable approach?
Any insight or suggestions would be greatly appreciated!
Thanks,
Sylvain