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 #1

Updated by François ARMAND over 4 years ago

  • Tracker changed from Bug to Architecture
  • Priority deleted (0)
Actions #2

Updated by François ARMAND over 4 years ago

  • Target version changed from 5.0.13 to 5.0.14
Actions #3

Updated by Vincent MEMBRÉ over 4 years ago

  • Target version changed from 5.0.14 to 5.0.15
Actions #4

Updated by Vincent MEMBRÉ over 4 years ago

  • Target version changed from 5.0.15 to 5.0.16
Actions #5

Updated by Nicolas CHARLES over 4 years ago

What would be the prefered way ? map{ case (a,b) => b.doSomething} ?

Actions #6

Updated by Alexis Mousset about 4 years ago

  • Target version changed from 5.0.16 to 5.0.17
Actions #7

Updated by Vincent MEMBRÉ about 4 years ago

  • Target version changed from 5.0.17 to 5.0.18
Actions #8

Updated by Vincent MEMBRÉ about 4 years ago

  • Parent task deleted (#15675)
Actions #9

Updated by Vincent MEMBRÉ about 4 years ago

  • Related to Bug #15675: Leak in Cache of Node Compliance and NodeInfo and perfs improvement added
Actions #10

Updated by Benoît PECCATTE almost 4 years ago

  • Target version changed from 5.0.18 to 6.2.0~beta1
Actions #11

Updated by Vincent MEMBRÉ over 3 years ago

  • Target version changed from 6.2.0~beta1 to 6.2.0~rc1
Actions #12

Updated by François ARMAND over 3 years ago

  • Status changed from New to Rejected

It's more complicated than that, and @ncharles already did a lot of work on that. Closing this one, a more details, case by case analysis need to be done.

Actions

Also available in: Atom PDF