Revert "avoid allocating memory"

This reverts commit 665c2f5bc03690489a3eddabba8fc2fe2d834dc7.