Slow, laggy Xcode? Maybe it’s not (just) Xcode…
Tags: ios, xcode
Published: 2019-04-08 14:17:12

---
title: Slow, laggy Xcode? Maybe it’s not (just) Xcode…
published: true
description: Xcode is fun to beat up. But when it comes to memory usage, it's not the only culprit anymore...
canonical_url: https://www.appsdissected.com/slow-laggy-xcode-memory/
tags: iOS,xcode
---

When you’re developing for iOS, there is pretty much no other game in town other than Xcode. And if you’ve needed to use it for any period of time, you know: <strong>it’s a memory hog</strong>. Not just Xcode, but the iOS simulator, Interface Builder, debugger… You can easily use several GB of memory with just the iOS development tools alone. If you have 8GB of RAM (or 4GB… 😱), it’s enough to bring Xcode to its knees, and your blood pressure to a boil. When your code completion starts lagging to the point you can’t type… 🤬

<strong>It’s 2019. Shouldn’t your machine be thinking faster than you?</strong>

But your problem may be more than just Xcode. You may want to look at what else is running on your machine to see if you need to put it on a RAM diet.

<hr />

Today, we live in the world of enormous browsers and Electron apps. Browsers are turning into full-fledged operating systems in their own right — and use enough memory to match. And because Electron apps each run their own instance of a web browser (Chrome) to present their app functionality, you could have multiple browser runtimes running on your machine at the same time, each taking 1-2GB of memory a piece. To run a web page. The desktop Slack app is the most cited example of this.

Run a few of these, and all of a sudden, it isn’t Xcode being the only memory hog. And that doesn’t include the several GB of RAM devoted to the operating system itself.

Once you’ve filled your memory, everything runs slow, because the operating system needs to decide what to keep in memory. And swap things in and out to your disk to keep the illusion that everything is in memory. Even with our souped-up SSDs, disks are slow.

Executive summary: Computers are great at multitasking, until they aren’t.

So if your Xcode is lagging, take a look at what you have open on your machine using Activity Monitor. Use the Memory tab and sort the Memory column to see your major abusers.

If you have other memory hogs, here are some things you can do:
<ul>
 	<li>If you are using an app to access a web-based service, consider using your web browser. You probably can’t kill your web browser anyway, so you may as well share the overhead.</li>
 	<li>If you have an app that you don’t need open for iOS development, temporarily shut it down to reclaim that memory.</li>
 	<li>Browsers are a pretty opinionated decision, but if you do not have a strong preference, consider switching to a lighter choice. Or perhaps, use that lighterweight browser just during coding sessions.</li>
</ul>
Hopefully once Marzipan is fully available, we’ll live in a world of Mac-ified iOS apps that run using much less memory than their Electron counterparts. Until then, practice some memory hygiene to improve your Xcode performance.

<hr />

Did you like this tip? The next tip on <a href="https://www.appsdissected.com/unwind-segues-storyboard/">using unwind segues to do backwards navigation in storyboards</a> is already waiting for you. 

Or <a href="https://www.appsdissected.com/newsletter/">sign up to get every tip straight to your inbox</a>, plus newsletter-only tips and deeper dives on website articles and discounts on future product launches.

This post originally published at <a href="https://www.appsdissected.com/slow-laggy-xcode-memory/">Apps Dissected.</a>