Dataloader to load batches into predefined buffer directly

You could take a look at this post showing the usage of multiprocessing.Array, which might fit your use case.