-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Hello,
we use owl on our ESP32 in our firmware zauberzeug/lizard. Occasionally, the ESP32 devices would hang during usage, especially when running long startup scripts.
After some digging, we found the function owl_default_tokenizer_advance
attempts to allocate 40 KB of RAM for every line processed. On an ESP32, this can quickly lead to problems due to limited memory availability.
In our version of owl, we reduced the allocation size from 4096 to 256, which now only consumes 2.5 KB of RAM. For example, in a longer call, we only process up to 24 tokens at a time, which works well with this adjustment.
Do you have an idea for making tokenizer_advance more scalable? One suggestion we had was to introduce a configurable parameter in owl_tree_options
to allow users to set the token count dynamically, with a default of 4096.
Optional Enhancement:
It could be beneficial to introduce a dedicated error state for cases where allocation fails, as the current error provided by owl does not clearly indicate that the issue is related to memory allocation. This would make diagnosing such problems more straightforward and user-friendly.