Right now, in the interpreted code, maps are freed when pools are cleared as well as when they are destroyed. This leads to substantially more map malloc/free calls than are necessary, since mostly when a pool is cleared, that space will be reused. In the compiled code, for example, maps are not freed (ever) since they are statically allocated.
I believe it should be sufficient to check that a map is not-NULL to see if it is allocated, since pools are cleared prior to use. The one downside is that destruction becomes slightly more expensive, since the code will need to be updated to check the entire allocated space to see if there are any maps that need freed. Actually, maybe it can just check until it finds one that hasn’t been allocated and then it is safe to assume that all subsequent maps are not allocated. That might be something to check.
Overall, the goal of this is to reduce the execution time of the nfer monitoring algorithm in the interpreted code path.