posit-dev / posit-dev/positron

Positron is copying large objects unnecessarily when working in the console

Open
#7,864 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: variables bug lang: r support
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 9h
Merged PRs (30d)
195

Description

System details:

Positron and OS details:

Positron Version: 2025.05.0 (Universal) build 142
Code - OSS Version: 1.99.0
Commit: 17df8dd67df471d39688fc6cd02e3f23543b4d72
Date: 2025-05-05T15:42:05.662Z (3 wks ago)
Electron: 34.3.2
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.4.0

Interpreter details:

R 4.5.0

Describe the issue:

Positron is copying large objects unnecessarily when working in the console

Steps to reproduce the issue:

Consider the following well behaved reprex which only results in the vector of 10 million values being copied once as expected.

library(lobstr)
x <- runif(10^8)
tracemem(x)
#> [1] "<0x300000000>"
y <- x
y[[1]] <- 1
#> tracemem[0x300000000 -> 0x32faf4000]:
y[[1]] <- 1

Created on 2025-05-28 with reprex v2.1.1

But when I execute each line of code one at a time in the Positron console the vector is actually copied twice.

> x <- runif(10^8)
> tracemem(x)
[1] "<0x32faf4000>"
> y <- x
> y[[1]] <- 1
tracemem[0x32faf4000 -> 0x38f0dc000]: 
> y[[1]] <- 1
tracemem[0x38f0dc000 -> 0x300000000]: 

Expected or desired behavior:

The expected and in the case of large objects desired behaviour would for the object to only be copied once when the code is executed line by line in the console in Positron. I note that this behaviour also occurs in RStudio so may be unavoidable but it is certainly unexpected and undesirable.

Were there any error messages in the UI, Output panel, or Developer Tools console?

No

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in the Positron console with R 4.5.0 using the supplied lobstr and tracemem examples. Compare line-by-line console execution with the standalone reprex and trace the extra copy; done means the large vector is copied once in Positron without introducing errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.