Add memory footprint measurement to test_lib.