I have this peculiar problem with running a Processing application in IntelliJ IDEA. I want to save a large image and to do this I run in to the following exception:
Changing vmoptions file adjusts the memory used by IntelliJ, but what you're having here is a shortage of memory of JRE that is launched by IntelliJ to execute your application. You need to adjust the memory setting in VM options part of the Run/Debug configuration, for example: