The Definitive Guide to RAM Previews and Disk Caches in After Effects (i.e. Those Blue and Green Lines)

After Effects is a challenging enough application to learn from a forward-facing perspective. Underneath the hood is a whole other story. But much like the Media Cache in Premiere, understanding a little behind the scenes action in AE can fix glitches, conserve system resources, and free up valuable hard drive space.

A quick concept to get started

To get started, one thing to understand is how playback differs between Premiere and After Effects. In Premiere, if you have a 60-second sequence and hit Play, the playhead will reach the end of the sequence in exactly 60 seconds, even if Premiere has to skip frames to do so. This is not always the case in After Effects. If you have a 10-second composition in After Effects and hit Play, it may take 10 seconds, or it might take 17 seconds, or it might take 2 minutes and 43 seconds. Common to most motion graphic applications, After Effects will not skip frames - it will play every frame of video, even if it has to slow down playback to do so. But usually, on the second play through, it plays smoothly. Why is this?

The growing green line (i.e. the RAM preview)

When you first play your timeline in After Effects, you will usually see a green line begin to grow over your layers. This is the RAM preview. RAM previews are part of something Adobe calls the Global RAM Cache, which is (mostly) automatically managed. After Effects is calculating the math of all your layers, effects, masks, keyframes, etc. to create temporary frames and stash them in your computer's RAM so it doesn't have to perform the calculations the next time you play the sequence. Sometimes the green line grows quickly, and sometimes it grows slowly. It depends on the complexity of your project and horsepower of your system.

 If the green line (the RAM preview) outpaces the red line (the playhead), you should see near real-time playback.

If the green line (the RAM preview) outpaces the red line (the playhead), you should see near real-time playback.

When you hit play for the first time in a comp, think of it as a race between the RAM preview and the playhead (a race where the playhead can never truly win). If the composition is simple, the RAM preview creation (the green line) will outpace the playhead, and you'll get real-time (or very close to real-time) playback. If your composition is complex, playback will be slow, down since the playhead cannot surpass the RAM preview. Once After Effects has created the RAM preview, you'll usually get real-time performance on a second play-through. That is, unless, you make a change to any parameter on any layer in your comp and then the RAM preview disappears and the process begins again, since even the tiniest changes causes After Effects to have to recalculate the altered frames all over again.

RAM previews will eat up as much RAM as you allocate to After Effects (you can control this in Preferences, under Memory). If you are working in many compositions at a time within a project, AE will continue to create RAM previews as you play each composition. Eventually, when AE fills the RAM cache, the oldest cached frames will be purged automatically. For example, you might create RAM previews of Compositions 1, 2, 3, and 4, but when you reach Composition 5, it may automatically purge the RAM preview from Composition 1. It depends on the length and complexity of your comps and how much RAM you have. This is one of the many reasons After Effects loves RAM!

Most of the time, you don't have to overthink this stuff. It just works (usually). But if you've devoted 30 of your 32GB of RAM to After Effects and your Global RAM Cache is full, what happens when you suddenly need to open Pro Tools or DaVinci Resolve? There's not much RAM left over for them.

There are two ways to get RAM back manually. The first is the most obvious and the one most people think they need to do - quit After Effects. Duh. You can force AE to give up its hold on RAM without quitting, by running a very simple command: Purge -> All Memory (found under the Edit menu).

In seconds, your RAM usage goes from this:

to this:

As soon as you run it, all green lines (those frames of video stored in your RAM) go poof. But here's where things get interesting. There MAY be…(get ready for it)… a BLUE line left behind in your timeline.

The thin blue line (i.e. the Disk Cache)

What is this madness? What you see evidence of is the After Effects Disk Cache. IF (and that's a big if) AE has enough overhead processing power when creating RAM previews, it will also take those frames and write them as files to your hard drive. The Disk Cache is super helpful for performance. If you were working on a complex composition and created a RAM preview, you would lose it when you quit the program at 5 pm and go home (ha, like you leave at 5 pm). The next day, you would have to regenerate the RAM preview from scratch which can be slow and time-consuming. Enter the Disk Cache. If the frames live in the Disk Cache, After Effects doesn't have to recalculate all the frames from scratch, just grab them from the Disk Cache folder and push them back into your RAM. Near instant RAM preview!

But the Disk Cache also eats up hard drive space - quickly. Luckily, there are limits in place, and you can alter them as well. If you go to After Effects' Preferences -> Media & Disk Cache, you will see options to change the Maximum Disk Cache Size (or disable it entirely). By default, After Effects dedicates a max of 10% of your hard drive size. And trust me, this gets filled up fast. A day's work on even a moderately complex project will like eat up the entire Disk Cache allotment, which will auto-delete the oldest disk cached frames as needed.

You can also forcibly purge the Disk Cache to recover disk space at any time from here, as well as from the Edit menu under the Purge sub-menu.

As for a quick reference to where the Disk Cache lives:

Mac: /Users/username/Library/Caches/Adobe/After Effects
Windows: C:\Users\username\AppData\Local\Temp\Adobe\After Effects

Why else should you purge?

If you've ever had glitchy frames in your composition or if the Composition window is stuck displaying one frame despite moving the playhead around, sometimes these issues are caused by problems with the cache. Purging the RAM previews often clears these problems up, and if it doesn't, you can try purging the Disk Cache as well.

How can I use this to enhance performance?

As stated right in the Media & Disk Cache preference pane, you can boost performance, sometimes considerably, by stashing your Disk Cache on a secondary drive. The faster the drive, the better. They don't need to be ginormous drives, just fast. Consider something like the 250GB Samsung T3 Portable SSD. This will increase the likelihood of frames being cached to the Disk Cache, free up hard drives space on your primary drive, and improve the recreation of RAM previews. If you spend a lot of time in AE, it's a must. Just don't forget to change the Disk Cache location and max out the Maximum Disk Cache size. Or only use half the drive for the Disk Cache and use the other half for Premiere and AE's Media Cache!