If the script is running fine on a 16 GB
machine, you can try increasing the virtual memory
of your own machine. But that could result in longer execution time of your script.
Instead, you should consider increasing RAM of your own machine.
To increase VM of your machine, go to
System properties->Advanced->Performance->Settings->Advanced->Virtual Memory->Change