Currently, some policy and script related methods are inefficiently allocating/reallocating containers where it is completely unnecessary.
This PR aims at optimizing policy verifications by reducing redundant heap allocations without losing performance even in worst case scenarios, effectively reducing the overall memory footprint.