Skip to content

Remove the 'static bounds #205

@ghost

Description

The reason why we require K: 'static and V: 'static on methods that remove elements is that removed nodes are added to the global epoch-based garbage collector. Nodes in the GC's garbage queue might get destroyed very late in the future, potentially after the skip list itself is dropped. If K or V hold any references, their destructors must be called before those references expire, hence the very conservative 'static bounds.

We can remove the 'static bounds only if we somehow guarantee that all garbage nodes added to the GC are destroyed before the parent skip list is dropped.

The easiest way to solve the problem is probably to create a new Collector in SkipList::new so that each skip list owns its GC, which gets dropped together with the skip list (dropping a GC destroys all remaining garbage in it).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions