Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Misc Compiler
    • Labels:
      None

      Description

      = problem =
      A lot of values that I compute are huge, and when done in the REPL, a
      binding similar to:

      val res3 = <big memory space value>

      is introduced by Scala. After a few of these bindings I run out of memory, and
      have to start the REPL afresh.

      Workarounds like always binding a var at the REPL and clearing it, or wrapping all REPL values with SoftReference are too annoying.

      = analysis =

      = enhancement recommendation =
      Always bind top level values to some fixed identifier like "it", etc.

        Issue Links

          Activity

          Hide
          Paul Phillips added a comment -

          I thought I'd implemented this, but when it didn't work I found it's harder than I thought, because MODULE$$ acts as a gc root on each line. I just have to change a few more things than I thought so it'll be a little bit.

          Show
          Paul Phillips added a comment - I thought I'd implemented this, but when it didn't work I found it's harder than I thought, because MODULE$$ acts as a gc root on each line. I just have to change a few more things than I thought so it'll be a little bit.
          Hide
          Jason Zaugg added a comment -

          Just checked this after a REPL :reset, same story.

          byte[33554432] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...}
           a of $line6.$read$$iw$$iw$
            MODULE$ of $line6.$read$$iw$$iw$
             [15] of java.lang.Object[40]
              elementData of java.util.Vector
               classes of scala.tools.nsc.interpreter.IMain$TranslatingClassLoader
                classLoader of scala.reflect.runtime.Mirror
          
          Show
          Jason Zaugg added a comment - Just checked this after a REPL :reset, same story. byte[33554432] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...} a of $line6.$read$$iw$$iw$ MODULE$ of $line6.$read$$iw$$iw$ [15] of java.lang.Object[40] elementData of java.util.Vector classes of scala.tools.nsc.interpreter.IMain$TranslatingClassLoader classLoader of scala.reflect.runtime.Mirror
          Hide
          Paul Phillips added a comment -

          Yeah, nothing short of nulling them out will get them back as things presently stand - they are statically reachable.

          Show
          Paul Phillips added a comment - Yeah, nothing short of nulling them out will get them back as things presently stand - they are statically reachable.

            People

            • Assignee:
              Unassigned
              Reporter:
              apollo
              TracCC:
              Paul Phillips, Seth Tisue
            • Votes:
              3 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:

                Development