You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So we register this in global (defined in top-level object) HashMap stored in variable qs. The consequence is that even if you don't use Global it'll be still hanging there because Statistics holds reference to it. This is a memory leak that I observed while using Scala IDE where Global used for compiling the code was kept around and consumed aroung 0.5GB of heap.
The text was updated successfully, but these errors were encountered:
@gkossakowski said:
The simple solution to avoid memory leak is to turn all operations in Statistics into no-ops in case statistics is disabled.
However, the whole design is broken because it doesn't work across many Globals. Also, life cycle of that top-level object is not clear to me since you can mutate enabled flag at any time.
In Types.scala we have the following code:
Let's have a closer look at
Statistics.newView
:As you can see
newView
takes by-name argument (that in our case closes over the whole Global) and passes it toView
.The
View
class inherits from Quantity that is defined as follows:So we register
this
in global (defined in top-level object) HashMap stored in variableqs
. The consequence is that even if you don't use Global it'll be still hanging there because Statistics holds reference to it. This is a memory leak that I observed while using Scala IDE where Global used for compiling the code was kept around and consumed aroung 0.5GB of heap.The text was updated successfully, but these errors were encountered: