Crash when reading from large clipboard on Windows

I've run into an issue where using utils::readClipboard() within an interactive RStudio session crashes RStudio if the clipboard is large. Running the same code within RGui or within an rmarkdown::render() works fine. If I steadily increase the number below from 2e3, to 2e4, to 2e5, to 2e6, it runs fine until I get to 2e5 and then crashes on 2e6. I'm using Windows 11, RStudio 2023.12.0-369, R 4.3.2 x64.

Reprex

(runs fine within reprex::reprex or RGui but crashes when run within RStudio).

writeClipboard(paste(1:2e6, collapse = " "));nchar(readClipboard())
#> [1] 14888895

Created on 2023-12-19 with reprex v2.0.2

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.