I have a reasonably complex system in Scala, with multiple threads and concurrent system calls. This system has a problem, because busy memory grows over time.
From the image below, you can see the memory occupation of the machine over the course of a day. When it reaches the limit, the process falls and I put on a watch-dog to raise it again.
Iperiodicallyrunthecommand
jcmd<pid>GC.run
Andthisdoesnotmakethememorygrowsofast,buttheproblemstillpersists.
Ididananalysiswithjvisualvm,comparingtheheapin2differentmoments,40minutesapart.Theimagebelowshowsacomparisonbetweentheheapattime1andtheheapattime0.Notethatthereisaconsiderableincreaseofinstancesofsomeclasses,suchasConcurrentHashMap$HashEntry
,SNode
,WeakReference
,char[]
andString
andvariousclassesofthescala.collection.concurrent
package.
Whatmightbecausingmymemoryleak?
Edit 1 : Investigating through JVisualVM, I noticed that the objects of class CNode and INode are in TriedMap, which in turn are instantiated in class sbt.TrapExit $ App. See the hierarchy of objects in the figure:
Post in English