Maybe it helps if you increase the memory:
You can resample the product to the 10m resolution of band B4 and B8 and afterwards you can create the subset with the two bands.
This can also be done in python. This thread might be helpful: