Skip to content

Clean up retained Data/List Viewer state for obsolete Interactive outputs #1838

Description

@eitsupi

Background

This was identified during a ChatGPT-assisted review of #1835.

Interactive rich outputs retain R-side viewer state in .sess_env$dataviews so that notebook cells can continue paging or opening their full Data/List Viewer without serializing the complete object.

However, these states do not appear to be released when the corresponding Interactive output is no longer live.

For example, #1835 stores each plain list result with:

dataview_set_state(view_id, root)

and Interactive table outputs similarly retain Data Viewer state. Once an Interactive generation becomes archived, the extension correctly disables live controls, but the corresponding R-side state may remain referenced until the runtime itself is stopped.

This means old Interactive outputs can keep potentially large R objects alive even though they can no longer be browsed live.

Possible direction

Consider managing these states as Interactive-owned viewer resources, and dispose them when they can no longer be used, for example when:

  • an Interactive generation is replaced or restarted;
  • retained history is evicted;
  • an Interactive session/output is otherwise permanently discarded.

This should probably cover both existing table outputs and the list outputs introduced in #1835 rather than adding list-specific cleanup.

The existing state_generation / dataview_dispose mechanism from #1741 may provide the appropriate foundation, but Interactive output retention and reconnect semantics need to be taken into account.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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