Implemented both possible buffer allocators for testing.