Skip to content

Display variable memory usage in hover tooltips (VS Code Jupyter) #17189

@ShakirKhurshid

Description

@ShakirKhurshid

When using VS Code Jupyter notebooks, variables (like large pandas DataFrames, NumPy arrays, or ML models) can consume a lot of memory, but it’s not obvious how much each one uses, which can lead to memory crash

I’d like to request a feature where hovering over a variable shows its memory usage in addition to the current type/shape/value preview. This would make it easier to monitor and manage memory usage during data science and ML workflows.

Why this would help

  • Easy and intuitive: No need to write extra code (sys.getsizeof, df.memory_usage, etc.) or install add-ons.
  • Useful for data scientists / ML engineers: Large datasets or tensors can take lot of memory, knowing their memory footprint at a glance helps optimize workflows.
  • Consistency with other IDEs: Tools like Spyder and RStudio show memory usage in their variable explorers.

Example UX idea

  • Hovering over a pandas DataFrame df could show:
    <class 'pandas.DataFrame'>, shape=(1_000_000, 10), memory=80 MB

Related work

  • VS Code Variable Explorer currently shows type, shape, and values, but not memory.
  • Classic Jupyter has the nbresuse extension for overall kernel memory, but not per-variable usage.

Impact

This feature would make resource management more transparent and help notebook users optimize their memory usage without extra coding.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions