Add memory measuring