Replace size with explicit memory in examples and tests