title: Cannot understand Intellij IDEA's memory usage and management
body: <p>Since a few years i am developing with IDEA again, and i am happy so far. 
  The problem is just weird memory usage behaviour and GC action while i am working on projects which causes my IDE freeze for a few seconds while GC is doing its job. 
  Regardless of how big the project is, i am working on, after a few days the memory usage increases upto 500 MBs (my heap space max 512 MB and actually, i assume, it had to be sufficient for web projects which has ca 100 java files). After GC did its job, i get 400 MB used - not collected - and just ca 100 MB free on heap and in a few mins the memory usage increases  the heap is full again. </p>
  
  <pre><code>JVM version is 19.0-b09
  
  using thread-local object allocation.
  Parallel GC with 2 thread(s)
  
  Heap Configuration:
     MinHeapFreeRatio = 40
     MaxHeapFreeRatio = 70
     MaxHeapSize      = 536870912 (512.0MB)
     NewSize          = 178257920 (170.0MB)
     MaxNewSize       = 178257920 (170.0MB)
     OldSize          = 4194304 (4.0MB)
     NewRatio         = 2
     SurvivorRatio    = 8
     PermSize         = 16777216 (16.0MB)
     MaxPermSize      = 314572800 (300.0MB)
  
  Heap Usage:
  PS Young Generation
  Eden Space:
     capacity = 145489920 (138.75MB)
     used     = 81242600 (77.4789810180664MB)
     free     = 64247320 (61.271018981933594MB)
     55.84070704004786% used
  From Space:
     capacity = 16384000 (15.625MB)
     used     = 0 (0.0MB)
     free     = 16384000 (15.625MB)
     0.0% used
  To Space:
     capacity = 16384000 (15.625MB)
     used     = 0 (0.0MB)
     free     = 16384000 (15.625MB)
     0.0% used
  PS Old Generation
     capacity = 358612992 (342.0MB)
     used     = 358612992 (342.0MB)
     free     = 0 (0.0MB)
     100.0% used
  PS Perm Generation
     capacity = 172621824 (164.625MB)
     used     = 172385280 (164.3994140625MB)
     free     = 236544 (0.2255859375MB)
     99.86296981776765% used
  </code></pre>
  
  <p>it's how my heap space seems. It is remarkable that Old Generation and Perm Generation use ca 100% their spaces. But i had triggered GC manually several times. The question is how can i get the IDE to sweep these objects in old generation without starting the IDE? (After start up the memory usage is about 60MB -90 MB) how can i find out what these are? There are some threads running which can be watched in VisualVM like RMI TCP Connection, RMI TCP Accept , XML RPC Weblistener and so on, although i do nothing on IDE and they're still consuming memory even 5-10 MBs per second. </p>
  
  <pre><code>$ uname -a
  Linux bagdemir 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 21:21:01 UTC 2011 i686 GNU/Linux
  
  $ java --version 
  java version "1.6.0_24"
  Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
  Java HotSpot(TM) Server VM (build 19.1-b02, mixed mode)
  </code></pre>
  
  <p>UPDATE: 
  memory configuration: 
  -Xms256m -Xmx512m -Xmn170m -XX:MaxPermSize=300m</p>