Scala Programming Language
  1. Scala Programming Language
  2. SI-6690

mutable.Queue of size 1 holds onto element after dequeue

    Details

      Description

      mutable.Queue is implemented by inheriting mutable.MutableList.

      when an element is enqueued into an empty mutable.Queue, mutable.MutableList modifies the
      first and last member variables to the only element in the queue. the dequeue method in mutable.Queue does not modify the value of last, so the queue holds onto the reference of the now dequeued element, which is a space-leak.

        Activity

        Hide
        Arya Asemanfar added a comment -

        illustration of the bug: https://gist.github.com/4119194

        Show
        Arya Asemanfar added a comment - illustration of the bug: https://gist.github.com/4119194
        Hide
        Jason Zaugg added a comment -

        Thanks for the precise report, Arya.

        https://github.com/scala/scala/pull/1732

        Show
        Jason Zaugg added a comment - Thanks for the precise report, Arya. https://github.com/scala/scala/pull/1732
        Show
        Adriaan Moors added a comment - https://github.com/scala/scala/pull/1732

          People

          • Assignee:
            Jason Zaugg
            Reporter:
            Arya Asemanfar
          • Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development