title: Memory leaking with ForkJoinTask[] and ForkJoinPool$WorkQueue in Play Framework (Scala)
body: <p>I have an application in Play Framework v2.3.7 written on Scala v2.11.4. It is running on a server and once per week crashes with the exception OutOfMemoryError: GC overhead limit exceeded. I'm trying to figure out what's wrong there. I made dump of memory and made histogram of all used classes (I used <code>jmap -histo</code>). And I found very weird results:</p>
  
  <pre><code>Object Histogram:
  
  num       #instances    #bytes  Class description
  --------------------------------------------------------------------------
  1:              24023   787570032       scala.concurrent.forkjoin.ForkJoinTask[]
  2:              96965   12420368        * MethodKlass
  3:              96965   11250824        * ConstMethodKlass
  4:              8424    8652552 * ConstantPoolKlass
  5:              8424    7547640 * InstanceKlassKlass
  6:              61739   5531288 char[]
  7:              7527    4799776 * ConstantPoolCacheKlass
  8:              24024   4612608 scala.concurrent.forkjoin.ForkJoinPool$WorkQueue
  9:              27289   3543672 byte[]
  10:             23190   2597280 scala.concurrent.impl.ExecutionContextImpl$DefaultThreadFactory$$anon$2
  11:             63921   2045472 java.util.concurrent.ConcurrentHashMap$HashEntry
  12:             3735    1470112 * MethodDataKlass
  13:             42877   1029048 scala.collection.immutable.$colon$colon
  14:             8834    1023064 java.lang.Class
  </code></pre>
  
  <p>So, there are a lot of instances of <code>ForkJoinTask[]</code> and <code>ForkJoinPool$WorkQueue</code>. So, I'm assuming, that it's queues and tasks for all my async calls and threads of the app. And I also think, in theory, they should be removed directly after they've been completed.</p>
  
  <p>What could be possible reasons of this issue? Maybe I missconfigured an ExecutionContext? Does anybody faced to this problem previously?</p>