This is my -xmx seting in IDEA
-xmx
-server -Xms512m -Xmx8192m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50