Add pre-allocation to memory measures.

This avoids issues with doubling the measurement vector sizes influencing memory measures.
Status Job ID Name Coverage
  Build
passed #3850
build_cmake

01:05

 
  Test
passed #3851
run_tests

01:04

 
  Sanitizer
passed #3852
run_address_sanitizer

02:12