SystemExtension Memory usage quite different in Instruments and Activity Monitor

One of our team members reported very high memory usage for our Network System Extension in Activity Monitor. Therefore, to check for leaks and accumulating memory, I plugged it into Instruments which shows quite low usage (~4MB) compared to Activity Monitor (40MB) at same moment. I am instrumenting release version of my extension (and App). So, my questions are:

  1. Why such a huge difference in these two tools?
  2. Which one should be considered more authentic/valid memory usage
  3. Is there any upper limit for Network System Extension? From my iOS experience, I remember iOS has 15MB limit for Network Extensions. Is there any such limit for Network System Extensions?

I'm going to try and answer what I can here, but this may not address all of your questions. First:

Is there any upper limit for Network System Extension? From my iOS experience, I remember iOS has 15MB limit for Network Extensions. Is there any such limit for Network System Extensions?

No, macOS Network System Extensions do not have a memory limit like the appex variant on iOS does.

Regarding:

Why such a huge difference in these two tools? Which one should be considered more authentic/valid memory usage

I tend to lean on Activity Monitor here for things like total accumulated process memory consumption. If you detach Instruments, do you see any difference here in your memory consumption for the Network System Extension?

Also, in your screen shot, I see two processes in Activity Monitor at the same time with the 40.8 m versus the 4.2 m memory usage recorded. Is the smaller one your container app?

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
SystemExtension Memory usage quite different in Instruments and Activity Monitor
 
 
Q