How to change IntelliJ memory usage properly on OsX

This is one of those quick posts with a small tip, this time the subject is how to change IntelliJ memory usage properly on OsX.

If you google a little bit looking for how to do that, you’ll probably find some zillions of posts saying that you should go to straight to /Applications/IntelliJ IDEA.app/Contents/bin/idea.vmoptions (don’t do this) and change it.

But even that it works, is kind of wrong, there’s a proper place “to place” your preferences, ~/Library/Preferences. This is what Apple say about this special folder:

The Preferences System

Preferences are application or system options that allow users to customise their working environment. Most applications read in some form of user preferences. For example, a document-based application may store preferences for the default font, automatic save options, or page setup information. Preferences are not limited to applications, however. You can read and write preference information, including user preferences, from any frameworks or libraries you define.

https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/UserPreferences.html

Why should we do this? Because this way you won’t mess up the original configurations and you’ll customise just for you without affecting any other user that maybe share the same Applications.

IntelliJ

Knowing about that, what you can do is just create the same file idea.vmoptions there, more specifically inside Idea’s folder, in my case:

~/Library/Preferences/IntelliJIdea2017.1/idea.vmoptions

You can place all your preferences into this file and IntelliJ will take whatever is here instead of the default one. Eg:

-server
-Xms2048m
-Xmx2048m
-XX:NewSize=512m
-XX:MaxNewSize=512m
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:+UseParNewGC
-XX:ParallelGCThreads=4
-XX:MaxTenuringThreshold=1
-XX:SurvivorRatio=8
-XX:+UseCodeCacheFlushing
-XX:+UseConcMarkSweepGC
-XX:+AggressiveOpts
-XX:+CMSClassUnloadingEnabled
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-XX:+CMSParallelRemarkEnabled
-XX:CMSInitiatingOccupancyFraction=65
-XX:+CMSScavengeBeforeRemark
-XX:+UseCMSInitiatingOccupancyOnly
-XX:ReservedCodeCacheSize=64m
-XX:-TraceClassUnloading
-ea
-Dsun.io.useCanonCaches=false

Now, next time that IntelliJ starts, it’ll take these configurations instead of the default ones without changing anything inside application’s original folders.

Allan de Queiroz

Allan de Queiroz
London based software engineer

XServer forward from Linux text mode for Headless purposes.

Hello, this post is about XServer forward from Linux text mode, **not ssh forward, anything related to VNC** or things like that.Recently...… Continue reading

MASM for x64 Platform on Visual Studio 2013

Published on June 04, 2017

Random Image Background Jetbrains Plugin

Published on May 15, 2017