Allocates and initializes multiple memory blocks.