On longer shots, RAM fills up and Mocha slows to a halt trying to play each next frame

It appears that while I’m playing a shot in Mocha, RAM usage is building up in both Mocha and AE at the same time, and once it hits the limit, the page file starts being hammered, which drops playback in AE to like 1fps or even lower, and the rest of my system hangs as well. Pausing the playback and telling Mocha to clear cache helps, for a while, until RAM fills up again.

Changing Mocha’s RAM limit doesn’t seem to be having much of an effect, because part of the problem is AE increasing its RAM usage at the same time. I’d have to significantly reduce AE’s RAM allocation while using Mocha and then increasing it again when rendering, so obviously that’s not an ideal situation. Is there anything I could do to avoid these issues?

Hi @morphinapg
What are your system specs and what kind of material are you working with (codec, resolution, length)? Can you share your log file in a state when your system is hanging?

As a workaround, you can use proxy preview mode in AE to reduce memory usage.

Sorry, I meant to include those details but forgot

Windows 11, Ryzen 5950X, 3080Ti, and 64GB of RAM. Footage is on two SATA SSDs striped together for faster read speeds, about 1GB per second sequential read.

The footage is 3840x2160 @ 30fps ProRes 422. I usually start having this issue on shots that are around 15 seconds or longer it seems.

I haven’t heard of proxy preview mode in AE, and google results are a little confusing for that. I have used proxies in the past in Premiere, so if you mean something similar to that, wouldn’t that mean the tracking would be based on lower resolution images? That wouldn’t be ideal, as many of the elements I track are a pretty small portion of that 4K image as it is, so I need precision in detail.

One thing I thought to attempt tonight is to leave Premiere open while I use mocha AE. When both Premiere and After Effects are open, each of those apps gets half the typical RAM allocation. Then on top of that, I considered reducing Mocha RAM allocation to 40%. In Adobe I have RAM reserved for other apps set to 8GB, normally leaving 56GB for AE, but if Premiere is still open, then AE only gets a maximum of 28GB. If I set Mocha to 40%, that gives Mocha a maximum of 25.6GB. Together, that totals 53.6GB, leaving 10.4GB for other apps. If both apps are handling RAM usage correctly, I would imagine RAM shouldn’t fill up, so page file shouldn’t be used, right? Correct me if I’m misunderstanding how RAM is allocated between the two.

Once I’m done with my work in Mocha, I can close Premiere before I have AE render, which should allow it to use more RAM at that point. I’ll have to test this tonight to see if it solves my problems or not, but if not, I’ll post a log.

Nope, tried playing through the last long shot with the above configuration, and the RAM still filled up all the way, and caused mocha to grind to a halt. Here’s the log, zipped because it’s a huge log.

mocha.zip (821.7 KB)

My problem is probably connected.
Moving spline vertices becomes very slow after a while - have to restart Mocha and reload the project - then editing splines works great again. Then after like 30 minutes of roto it becomes slow again, so I have to restart again :frowning:
PS. The only newish thing I can think about is the shots are in ACES 2065 EXRs.
Ryzen 7950X, 128GB DDR5 RAM, Win 10, RTX 4090

Yeah I have that problem too, but I would imagine it’s a different situation. Seems to be tied to how many points are in the layer, plus how many adjustments you make to those points, but there appears to be no solution in sight.

I created a thread for that problem here:

Yes, you are right. But I still think both of these issues are connected to running out of RAM. I can work significantly longer in Mocha without experiencing the slowdowns if I quit AE and free up RAM :confused:

Well the other issue would still happen to me even when I had plenty of RAM left, so that’s why I thought maybe it wouldn’t be that, although I’m sure running out of RAM would make it worse of course.

This is what i mean by proxy preview. By default it is set to Auto in AE. And yes, by manually switching it to Half/Third or Quarter, you will be tracking on lower resolution images. That will help to reduce memory usage and usually that’s still enough resolution to get a good track if you’re starting with something like 4K footage. But if you tacking really small areas i see why this might be not an ideal solution for you.

Thanks for sharing the log. I would check with the team and get back to you

Thanks
Elizabeth

I’ve looked at your log and have some suggestions to improve performance.

  1. Update to Mocha Pro 2023 if you can. It reduces CPU utilisation when running in AE.
  2. Set your “Amount of Texture RAM to Reserve” to 256 MiB (the default). On modern hardware, there’s no real benefit to storing more than a couple of frames in texture memory because they can be streamed from system memory fast enough.
  3. Turn your %RAM in Mocha way down. Memory allocation between Adobe applications doesn’t work exactly how you described - it’s detailed here:

Memory (RAM) usage in 64-bit After Effects

I suggest you set Mocha’s RAM usage to 10%; you could even go down to 5%. This will only allow it to maintain a few frames of cache and should prevent swapping. On your 64 GB system, try to keep 16 GB free for other programs, system buffers and things like that.

Hope this helps, please let us know if these changes make a difference.

J-P

Update to Mocha Pro 2023 if you can. It reduces CPU utilisation when running in AE.

I don’t currently need the Pro features, so I’ve just been using AE in the meantime. I will keep that in mind, but CPU utilization is hardly an issue here.

Set your “Amount of Texture RAM to Reserve” to 256 MiB (the default). On modern hardware, there’s no real benefit to storing more than a couple of frames in texture memory because they can be streamed from system memory fast enough.

What’s the drawback? I’ve got plenty of VRAM and don’t need it for other things while using Mocha.

Turn your %RAM in Mocha way down. Memory allocation between Adobe applications doesn’t work exactly how you described

The way I described it was based on what I was seeing in the “Show Memory Usage Details” dialogue box in AE preferences.

I suggest you set Mocha’s RAM usage to 10%; you could even go down to 5%. This will only allow it to maintain a few frames of cache and should prevent swapping.

Well I’d like to keep it as high as I can without RAM filling up, so I suppose I can keep trying different settings.The last couple nights, 40% has been working well, even on long shots. Just did an 1800 frame shot tonight and it never hanged the entire time, but yeah if it happens again I’ll try reducing it some more.

On your 64 GB system, try to keep 16 GB free for other programs, system buffers and things like that.

I’ve found that reserving 8GB for other programs in AE has made it so that the rest of my system never hangs on memory intensive operations in AE, so I think 8GB is enough for my situation, and I use every bit as much of the RAM available to AE in many situations, so I’d like to avoid reducing what it can work with if I can accomplish the same results with other means so I will consider raising memory saved for other programs, but I will try other things first.

I’ve just noticed that the “Show Memory Usage Details” dialogue is showing something different than I’ve seen before, apparently making use of the different priorities as described in that article:

I would expect that this is probably the worst case scenario for how much memory AE would be able to use while Premiere is open, so based on that, it looks like if AE maxes out and Premiere stays around that level, the total Adobe usage would be about 47GB, leaving about 17GB for the rest of the system. If I want to leave 8GB for everything else, that would mean Mocha could use a maximum of 8GB, or 12.5% of system memory.

However, when AE is in the background, the dialogue changes to this:

And as such, I would be able to use a maximum of about 13GB for Mocha using the same math, which would be about 20%. Am I right to assume AE would be considered to be running in the background when I’m working with Mocha AE? Unfortunately I can’t keep this dialogue open while Mocha is open, so I can’t check.

EDIT: did another test. I increased Mocha’s RAM setting to force it to run into a hang, then I immediately closed mocha and checked out how much RAM was freed up. About 40% of my RAM was freed up in that moment. So if I set it to 35% I would imagine that could potentially solve the problem?

Sorry about the suggestion to move to Pro, I missed that we were in the Mocha AE forum :man_facepalming:. The same improvements that are in Mocha Pro 2023 will be coming to Mocha AE soon, and they don’t directly impact this memory question.

When you use Mocha AE, After Effects can be quite busy acting as a frame server for Mocha. Especially on a longer shot that doesn’t fit into AE’s RAM cache, it will be busy decoding frames from the source clip or reading them from its disk cache. This means it can use just as many resources as it does when it’s in the foreground - including VRAM if there are GPU-enabled effects or GPU-based video decoding upstream of Mocha.

In a future release we are going to automate the texture RAM setting in Mocha because the way it works now isn’t obvious, and we see many support cases caused by it being set too high.

Everyone’s system is different and experimenting as you are doing is sensible. Just bear in mind the way memory is used when the Mocha UI is open (assuming UHD 8-bit RGB):

ProRes 422 clip on disk (~2.5 MB per frame)
→ Image in AE’s cache (~25 MB per frame)
→ Image in Mocha’s cache (~25 MB per frame)

Recent versions of Mocha can move UHD images from AE’s cache to Mocha’s cache in realtime, meaning there isn’t much benefit having a large cache on Mocha’s side - which is why I suggested minimising this. Having a large cache in AE helps because the output of effect renders and compositing operations will be cached, but in Mocha AE, all we are caching is the original video frames, so if we can read them back in realtime from the source, there is no real benefit to caching.

YMMV and if you get good results with your settings then stick with them. The main point I’m trying to make is that increasing Mocha’s system RAM and texture RAM usage can make performance worse so it needs to be done carefully.

1 Like

Thank you for all the info. I did try the 35% option I suggested above but did encounter a hang, so I dropped it to 30% and so far so good but we’ll see how that goes. I did some testing with a longer shot, and with Premiere, After Effects, and Mocha open, after doing some work on the shot in Mocha I was using about 9 GB out of my 12GB VRAM, so I would imagine it’s probably not an issue, but I can drop it if you think it won’t have a negative impact. I don’t have any other effects enabled in AE while working in Mocha. I pretty much always work with Mocha first, and then do the other stuff.

It would certainly be nice if Mocha could directly use AE’s cache instead of needing its own, lol

And no issue about the Pro confusion. I do use Pro features on some projects, but for others, Mocha AE is good enough for what I need, so I don’t have a subscription at the moment.