You're deep into a 4K comp with 30 layers of adjustment layers, motion blur on, and you hit RAM preview. After Effects chugs for a second then throws up that gem: 'Out of memory: 0 bytes requested.' Zero bytes. Like the machine just gave up. I've seen this on a client's Dell Precision with 64GB RAM, and it wasn't the first time. It's usually one of three things: your RAM allocation is mismanaged, your disk cache is full, or a corrupted cache file is stuck. Let's kill it for good.
Why does this happen?
After Effects is a memory hog. Not in a bad way—it's just how it works. When you work on large compositions, it tries to keep as much in RAM as possible for previews. But Windows 11 also needs RAM, and other apps (Chrome, Slack, whatever) are chewing it too. If you've set After Effects to use 90% of available RAM, it'll end up fighting for the same memory Windows is using for system processes. That mismatch causes After Effects to think it can't allocate any memory, hence the '0 bytes' nonsense.
The second culprit is a full disk cache. AE uses a cache folder on your drives to store frames it's already computed. If that folder is on a small SSD and it's 100% full, AE can't write to it, and it'll throw the same error even if RAM is fine.
Third, and this is sneaky: a corrupted cache file from an older session (or a crash) can confuse AE into thinking memory is unavailable. That one's the easiest to fix but often missed.
Step-by-step fix
Step 1: Change your memory settings
This is the first thing I do, and it fixes 80% of these cases. Go to Edit > Preferences > Memory & Performance (on Windows, it's under File > Preferences if you're on an older version).
Look for 'Installed RAM' and 'RAM reserved for other applications'. The default is usually 6GB reserved. That's often too low if you're running Windows 11 with a bunch of background services. Bump that to 8GB or even 12GB if you have 32GB+ RAM. This gives Windows breathing room, and AE stops fighting for every byte.
Also, make sure 'Memory usage' isn't set above 80%. I know you want max preview speed, but going beyond that leads to exactly this error. Set it to 75-80% and you'll barely notice a difference in preview speed, but you'll kill the error.
Step 2: Clear and reset the disk cache
If step 1 didn't do it, your cache is likely the problem. Head to Edit > Preferences > Media & Disk Cache.
Click 'Clean Database & Cache'. That wipes out all the cached frames. Yes, it'll take a few minutes to rebuild your previews, but it's the fastest way to clear corrupted files.
While you're there, check the cache location. Make sure it's on a drive with at least 20GB free. I've seen clients set it to their C: drive which is nearly full. Move it to a secondary SSD if you have one. And set the maximum cache size to something reasonable—50GB is plenty unless you're churning out 8K comps all day.
Step 3: Restart After Effects clean
Sometimes AE just needs a full reset. Close After Effects completely. Then open Task Manager (Ctrl+Shift+Esc) and check if any AfterFX.exe processes are still running. Kill them all. Then restart AE.
If you're still seeing the error after that, the cache file might be stubborn. Go to the cache folder manually (you can find the path in the same Media & Disk Cache preference). Delete everything inside it. On Windows 11, it's usually something like C:\Users\[YourName]\AppData\Roaming\Adobe\After Effects\[Version]\Cached Files. Just nuke it.
Step 4: Update your graphics drivers (seriously)
This one sounds like a cop-out, but I've had a client whose error vanished after updating their NVIDIA driver. After Effects uses the GPU for effects and rendering, and if the driver is a mess, it can cause memory allocation failures. Go to NVIDIA or AMD's site, get the latest driver, and install it. Restart your machine, then try again.
What to check if it still fails
If you've done all the above and AE still throws 'Out of memory: 0 bytes', there's one more thing: your Windows page file. After Effects uses virtual memory even if you have tons of RAM. If your page file is set to a small fixed size, AE can't allocate extra memory when it needs to.
Go to Settings > System > About > Advanced system settings (search for it in the Start menu). Under Performance, click Settings. Go to Advanced tab, then under Virtual memory click Change. Uncheck 'Automatically manage', select your C: drive, and set a custom size. Make the initial and max size something like 16384MB (16GB) if you have 16GB RAM or more. That gives AE a safety net.
Also check if you've got a background app like a browser with 50 tabs open. Close that. It sounds obvious, but I fix this on the regular because people forget Chrome eats RAM like candy.
One last thing: if you're on a laptop with integrated graphics plus a dedicated GPU, make sure After Effects is using the dedicated one. Go to Windows Graphics settings and set After Effects to 'High performance'.
That's it. I've never seen this error survive these steps. If it does, your project might have a specific layer or effect causing it—try disabling effects one by one to isolate the culprit. But honestly, the memory settings and cache clear get you 9 times out of 10.