The error shouldn’t be raised, if your device has enough memory.
Could you explain a bit more why you think there is enough memory and how you’ve estimated the memory requirement needed in your script?