refactoring the memory tests to ensure uniformity between _buff and _nobuff variants