zeek/spicy

`spicy-build`: High memory consumption reading files.

Closed this issue · 2 comments

While processing a file (-f) with an executable created by spicy-build the process' memory consumption is constantly growing up to the size of the input file. Looks like processed input is never released. Running the same parser using spicy-driver, the memory consumption is stable.

This is a current limitation of spicy-build. The way it generates C++ code does not work with optimizations enabled, so it disables them,

execute $(${spicy_config} --spicyc) -g ${hiltic_flags} -c -o ${cc} ${i} || exit 1

Random access is currently always enabled for all units, but removed for units which do not need it by the optimizer. Since spicy-build does not optimize random access is always on. This e.g., means that input is not trimmed leading to the growth you reported.

It might be possible to rewrite spicy-build so instead of disabling optimizations it leaves them on and possibly makes use of spicyc's -x flag to emit sources and using a single invocation of spicyc. With that we might have a global enough view to emit all required code, even after optimizations.