Skip to content

Array ring buffer wastes capacity  #320

@franz1981

Description

@franz1981

After eons I wanted to reuse this structure for http 2 stream handling in Netty and..

Doesn't seem to account for gaps 😕

i.e.

  1. Add 3 elements
  2. Remove with index the first 2 inserted: head sequence is still there but we have null out two slots
  3. Remove the last and observe that we won't get back anymore the full capacity although all 4 elements are gone

Remove should keep on checking bubbles of nulls to move the head as much as it can, till the tail, if necessary (or stopping at the first non null).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions