为什么将一个大的图像复制到剪贴板会冻结一台计算机?

有时,当使用我们的电脑时,会发生一些非常奇怪的事情,完全没有意义……比如把一个简单的图像复制到剪贴板上,电脑就因此冻结了。图像就是图像,对吗?今天的超级用户帖子回答了一个困惑读者的难题。...

为什么将一个大的图像复制到剪贴板会冻结一台计算机?

有时,当使用我们的电脑时,会发生一些非常奇怪的事情,完全没有意义……比如把一个简单的图像复制到剪贴板上,电脑就因此冻结了。图像就是图像,对吗?今天的超级用户帖子回答了一个困惑读者的难题。

今天的问答环节是由SuperUser提供的,SuperUser是Stack Exchange的一个分支,是一个由社区驱动的问答网站分组。

原始图像由维基媒体提供。

问题

超级用户读者Joban Dhillon想知道为什么将图像复制到他电脑上的剪贴板会使其冻结:

I was messing around with some height map images and found this one:

(http://upload.wikimedia.org/*********/comm***/1/15/Srtm_ramp2.world.21600×10800.jpg)

007Ys3FFgy1gpfjbv7dgaj30dw06yjrj

The image is 21,600*10,800 pixels in size. When I right click and select “Copy Image” in my browser (I am using Google Chrome), it slows down my computer until it freezes. After that I must restart. I am curious about why this happens. I presume it is the size of the image, although it is only about 6 MB when saved to my computer. I am also using Windows 8.1

为什么一个简单的图像在复制到剪贴板后会冻结Joban的电脑?

答案

超级用户贡献者Mokubai为我们提供了答案:

“Copy Image” is copying the raw image data, rather than the image file itself, to your clipboard.

The raw image data will be 21,600 x 10,800 x 3 (24 bit image) = 699,840,000 bytes of data. That is approximately 700 MB of data your browser is trying to copy to the clipboard.

JPEG compresses the raw data using a lossy algorithm and can get pretty good compression. Hence the compressed file is only 6 MB.

The reason it makes your computer slow is that it is probably filling your memory up with at least the 700 MB of image data that your browser is using to show you the image, another 700 MB (along with whatever overhead the clipboard incurs) to store it on the clipboard, and a not insignificant amount of processing power to convert the image into a format that can be stored on the clipboard.

Chances are that if you have less than 4 GB of physical RAM, then those copies of the image data are forcing your computer to page memory out to the swap file in an attempt to fulfill both memory demands at the same time. This will cause programs and disk access to be sluggish as they use the disk and try to use the data that may have just been paged out.

In short: Do not use the clipboard for huge images unless you have a lot of memory and a bit of time to spare.

Like pretty graphs? This is what happens when I load that image in Google Chrome, then copy it to the clipboard on my machine with 12 GB of RAM:

007Ys3FFgy1gpfjbvts3hj30ce0djaak

It starts off at the lower point using 2.8 GB of RAM, loading the image punches it up to 3.6 GB (approximately the 700 MB), then copying it to the clipboard spikes way up there at 6.3 GB of RAM before settling back down at the 4.5-ish you would expect to see for a program and two copies of a rather large image.

That is a whopping 3.7 GB of image data being worked on at the peak, which is probably the initial image, a reserved quantity for the clipboard, and perhaps a couple of conversion buffers. That is enough to bring any machine with less than 8 GB of RAM to its knees.

Strangely, doing the same thing in Firefox just copies the image file rather than the image data (without the scary memory surge).


有什么要补充的解释吗?在评论中发出声音。想从其他精通技术的Stack Exchange用户那里了解更多答案吗?在这里查看完整的讨论主题。

  • 发表于 2021-04-11 09:13
  • 阅读 ( 157 )
  • 分类:互联网

你可能感兴趣的文章

如何在mac和windows之间同步剪贴板

...接粘贴到另一个设备上?macossierra为iPhone用户提供了自动剪贴板,而且在Windows和Android之间共享剪贴板也很容易。 ...

  • 发布于 2021-03-12 18:06
  • 阅读 ( 429 )

你需要一个剪贴板管理器替代品

...:Microsoft缓存服务将于2017年2月28日关闭。看看这些替代剪贴板应用程序。 ...

  • 发布于 2021-03-16 22:56
  • 阅读 ( 198 )

如何将文件复制到Windows10上的usb闪存驱动器

...复制到该位置。 如何使用复制粘贴复制文件 也可以使用剪贴板在Windows中复制文件。使用鼠标光标,选择要复制的文件,然后右键单击所选内容。在弹出的菜单中,选择“复制” 将鼠标光标放在USB thumb drive窗口中的一段空白区...

  • 发布于 2021-04-01 18:27
  • 阅读 ( 191 )

如何将文本和图像固定到Windows10的剪贴板历史记录

Windows10通过一个名为剪贴板历史记录的功能使复制和粘贴更加方便。它允许您将经常复制并粘贴到列表中的项目固定起来,以便快速访问。下面是如何使用它。 什么是剪贴板历史记录(clipboard history)? 剪贴板历史记录在Windows 1...

  • 发布于 2021-04-02 03:50
  • 阅读 ( 166 )

如何在microsoft word中剪切、复制和粘贴

...制文本中的格式标记,可以用不同的方式来解释。这就是为什么您可能会发现从网站复制的文本在Word中显示得更大;Word对格式标记的解释与web浏览器不同。 您可以单击“主页”>“粘贴”查看一些不同的选项,而不是按Ctrl+V...

  • 发布于 2021-04-04 23:45
  • 阅读 ( 185 )

使用Windows10的新剪贴板:历史和云同步

Windows 10的2018年10月更新带来了新的剪贴板体验。现在,您可以访问已复制到剪贴板的项目的历史记录、固定常用项目,以及在PC上同步剪贴板。 如何启用新的剪贴板功能 要启用这些新的剪贴板功能,请转到“设置”>“系统...

  • 发布于 2021-04-06 09:05
  • 阅读 ( 177 )

windows最佳免费截图应用

...cn键,将屏幕的副本(或Alt+PrtScn仅用于活动窗口)保存到剪贴板。然后可以将其粘贴到任何应用程序中。而且,在Windows10上,您甚至可以按Windows+Shift+S来捕获屏幕的某个区域并将其复制到剪贴板。 相关:如何在windows10中截图 如...

  • 发布于 2021-04-06 10:57
  • 阅读 ( 186 )

如何在windows和macos之间同步剪贴板

...台电脑上复制一些东西,然后粘贴到另一台电脑上?同步剪贴板正在变得越来越普遍:例如,你可以在macossierra和ios10之间同步剪贴板,而无需任何第三方软件。Pushbullet允许您将Windows剪贴板同步到Android(以及其他功能) 如果你...

  • 发布于 2021-04-07 10:04
  • 阅读 ( 172 )

如何在windows10中截图

...用打印屏幕(prtscn)快速截图 按PrtScn按钮将屏幕复制到剪贴板 按键盘上的Windows+PrtScn按钮将屏幕保存到文件中 使用内置的剪断工具 在Windows10中使用游戏栏 键盘上的“打印屏幕”按钮可以拍摄屏幕截图并将其保存为文件,也可...

  • 发布于 2021-04-08 01:15
  • 阅读 ( 210 )

如何在linux上截图

...图”按钮。从那里,您可以将图像保存到计算机或复制到剪贴板。 GNOME屏幕截图通常是大多数发行版的默认屏幕捕获工具,这些发行版附带基于GTK的桌面环境,如GNOME、MATE、LXDE、Cinnalon、Budgei、Pantheon和其他环境。不过,XFCE附带...

  • 发布于 2021-04-09 06:37
  • 阅读 ( 192 )
彤彤彤彤-
彤彤彤彤-

0 篇文章

相关推荐