Project

General

Profile

Actions

Architecture #15678

closed

Remove Map#mapValues because of memory not freed

Added by François ARMAND over 4 years ago. Updated over 3 years ago.

Status:
Rejected
Priority:
N/A
Assignee:
-
Category:
Performance and scalability
Target version:
Effort required:
Name check:
To do
Fix check:
To do
Regression:

Description

Map#mapValues is only a view on the original map. The original values are still referenced and the original map never freed.

For this one, the leak is really tricky, because in that code:

  def main(args: Array[String]): Unit = {
    def res() = {
      printMem("in res 0")
      val m = Map(1 -> bigArray, 2 -> bigArray, 3 -> bigArray)
      val m2 = m.mapValues(_ => smallArray)
      printMem("in res 1")
      m2
    }
    printMem("start")
    val map1 = res()
    printMem("end")
  }

m is still referenced during all the life of m2 and so map1. But from map1 point of view, it's a simple, small map.


Related issues 1 (0 open1 closed)

Related to Rudder - Bug #15675: Leak in Cache of Node Compliance and NodeInfo and perfs improvementReleasedNicolas CHARLESActions
Actions

Also available in: Atom PDF