Boost.Parser seldom allocates memory. The exceptions to this are:
symbols
allocates memory for the symbol/attribute pairs it contains. If symbols
are added during the parse, allocations must also occur then. The data
structure used by symbols is also a trie,
which is a node-based tree. So, lots of allocations are likely if you
use symbols.
boost::parser::trace::on to a top-level
parsing function, the names of parsers are allocated.
operator>),
the name of the failed parser is placed into a std::string,
which will usually cause an allocation.
string()'s attribute is a std::string, the use of which implies allocation.
You can avoid this allocation by explicitly using a different string
type for the attribute that does not allocate.
repeat(p) in
all its forms, including operator*, operator+,
and operator%, is std::vector<ATTR(p)>,
the use of which implies allocation. You can avoid this allocation by
explicitly using a different sequence container for the attribute that
does not allocate. boost::container::static_vector or C++26's
std::inplace_vector may be useful as such replacements.
With the exception of allocating the name of the parser that was expected
in a failed expectation situation, Boost.Parser does not does not allocate
unless you tell it to, by using symbols, using a particular
error_handler, turning on trace, or parsing into attributes that allocate.