Google Chrome – Large Image to Clipboard Freezes Computer

clipboardgoogle-chromeimages

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

http://upload.wikimedia.org/wikipedia/commons/1/15/Srtm_ramp2.world.21600×10800.jpg

This image is 21600×10800 when I right click "copy image" from my browser (I am using chrome) it slows down my computer until it freezes. After that I must restart. I am curious to why this happens I presume it is the size of the image, all though its only about 6mb when saved.

I am also using Windows 8.1

Best Answer

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

The raw image data will be 21600 x 10800 x 3 (24 bit image) = 699,840,000 bytes of data. That's approximately 700MB of data your browser is trying to poke onto the clipboard.

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

The reason it makes your computer slow is that it is probably filling your memory up with at least the 700MB image data that your browser is using to show you the image, another 700MB (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 4GB or less 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 fulfil both memory demands at the same time. This will cause programs and disk accesses to be sluggish as they use the disk and try to use the data that may have just been paged out.

In short: don't 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 Chrome and then copy it to the clipboard on my machine with 12GB of RAM:

enter image description here

It starts off at the lower point using 2.8GB of RAM, loading the image punches it up to 3.6GB (approximately maybe the 700MB), 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'd expect to see for a program and two copies of a rather large image.

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

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

Related Question