There is a memory issue when trying to export an image in large resolution, which can hang your mac easily. The issue is reproducible in the latest sketch version. Steps:
- Create a 100×100 artboard
- Make four copies of it
- Select them all
- Click on “Make exportable”
- Set size to 100x (this can happen by mistyping
w
)
- See how the memory consumption increases significantly
Sketch: 101.1 (182003)
macOS: 15.0 (24A335)
Hey Roman,
Thanks for sharing this. Increased memory usage is expected due to the large size that’s exported. Additional resources are needed to export the images but memory should recover once the export is done.
There are some teams and users that do need to export super large images. We had tried the opposite approach: limit the size, but we affected those that need large sizes and now, limits are based not on artboard size, but on the limits of each format (PNG, JPEG, etc). Large exports will perform according to hardware capabilities.
I just tested your example in my M1 MacBook Air with 8GB RAM (nothing fancy at all). Sketch didn’t become unresponsive, memory did climb, but recovered once the export was completed.
I don’t think this memory jump is reasonable to be honest. The exported image weighs only 5mb but the memory usage increases 5 times just to render a preview in the sidebar. For fancy results please try to open the attached file and select all 6 artboards at once.
Memory Test.sketch (7.2 KB)
Hey Roman,
Oh, I see what you mean. The Inspector generates the preview but it also generates the asset. The Inspector has a feature where you can drag and drop an asset from the preview panel on the Inspector to the canvas. The asset needs to be generated so it’s ready when you drag and drop it. That’s the memory increase you noticed when the preview was generated.
Memory climbs because the app needs to create the 100x asset. If you select the 6 artboards at once, it will need more memory, because it’ll generate 6 assets that are 100x.
When you set a more common export, like 2x, the preview and asset drag and drop work way faster
1 Like
Thanks Jorge! Yes, this is not a common use case. My wife caught on that without realising what was going on. The app freezed and the memory usage was well over 70GB. It took me a bit to realise that she was trying to export stuff at 512x instead of 512w, so I thought I should let you know. This could be an (low prio.) area for improvement
1 Like
Absolutely, thanks so much for taking the time to share this!
Image export is a topic that goes deep, with a lot of different scenarios. An app hang like this one can be hard to catch and avoided if possible. Perhaps previews could be separate from the actual asset generation. Right now they are true to how they’ll look: a 1x 32x32 PNG will be pixelated but a 3x or a SVG one won’t; but we also have this scenario where the asset is huge and performance takes a hit and it can also affect your Mac’s performance.
I’ve documented this case to see how we can improve this.
Thanks so much for all the time and help and please feel free to share any other feedback