what's the rpages in jetsameEvent files?

I'm developing a PacketProvider on iOS. It is often kill by memory limit. This is jetsameEvent file log the memory issue


  {
    "uuid" : "14350be0-e8a2-3419-b7fa-42ae204997e5",
    "states" : [
      "frontmost"
    ],
    "killDelta" : 13593,
    "lifetimeMax" : 795,
    "age" : 1001079202730,
    "purgeable" : 0,
    "fds" : 200,
    "genCount" : 0,
    "coalition" : 633,
    "rpages" : 960,
    "reason" : "per-process-limit",
    "pid" : 4624,
    "idleDelta" : 4,
    "name" : "RebornTunnel",
    "cpuTime" : 1223.5413490000001
  },


The rpages is 960 and pageSize is 16k, it exceeded the 15MB limit.


So I used the Allocations and Leaks tool in the Instrument, and it looks like the memory usage is always 6mb for a long time, and there is no memory leak.


Next, I use the activity monitor to track the real memory of the process. And manually triggering jetsam event to obtain the rpages of the process. The result is:



  ---------------------------------------------------------

  Activity Monitor real memory: 8.9MB

  JetsamEvent file:
  {
    "uuid" : "45eb176c-a6a2-3d21-a83e-e0a1d906e689",
    "states" : [
      "frontmost"
    ],
    "lifetimeMax" : 1025,
    "age" : 752714310856,
    "purgeable" : 0,
    "fds" : 100,
    "coalition" : 633,
    "rpages" : 761,
    "pid" : 15273,
    "idleDelta" : 7,
    "name" : "RebornTunnel",
    "cpuTime" : 28.378858999999999
  },


  ---------------------------------------------------------

  Activity Monitor real memory: 7.2MB

  JetsamEvent file:
  {
    "uuid" : "45eb176c-a6a2-3d21-a83e-e0a1d906e689",
    "states" : [
      "frontmost"
    ],
    "lifetimeMax" : 1025,
    "age" : 824910659065,
    "purgeable" : 0,
    "fds" : 200,
    "coalition" : 633,
    "rpages" : 846,
    "pid" : 15273,
    "idleDelta" : 7,
    "name" : "RebornTunnel",
    "cpuTime" : 58.712065000000003
  },

  ---------------------------------------------------------

  Activity Monitor real memory: 7.4MB

  JetsamEvent file:
  {
    "uuid" : "45eb176c-a6a2-3d21-a83e-e0a1d906e689",
    "states" : [
      "frontmost"
    ],
    "lifetimeMax" : 1025,
    "age" : 862117778147,
    "purgeable" : 0,
    "fds" : 200,
    "coalition" : 633,
    "rpages" : 873,
    "pid" : 15273,
    "idleDelta" : 7,
    "name" : "RebornTunnel",
    "cpuTime" : 67.771770000000004
  },


the rpages is always increase, but the real mem is not. So iOS is based on the memory used by rpages as a basis for memory limits, not based on actually used memory? I find real memory is equal to residentSize, so what's the relationship between rpages and residentSize.


These tests were performed on the iPhoneX.

what's the rpages in jetsameEvent files?
 
 
Q