The show task memory command displays a Currently In Use value measured in kilobytes. This value represents the memory currently in use. It is the dynamically allocated memory plus the DATA segment memory. The show system processes extensive command displays a RES value measured in kilobytes. This value represents the amount of program memory resident in the physical memory. This is also known as RSS or Resident Set Size.
The Currently In Use value does not account for all of the memory that the routing protocol process uses. This value does not include the memory used for the TEXT and the TACK segments, and a small percentage of memory used by the routing protocol process’s internal memory manager. Further, the RES value includes shared library pages used by the routing protocol process.
Any amount of memory freed by the routing protocol process might still be considered part of the RES value. Generally, the kernel delays the migrating of memory out of the Inact queue into the Cache or Free list unless there is a memory shortage. This can lead to large discrepancies between the Currently In Use value and the RES value.
For more information, see Junos OS Routing Protocols Library for Routing Devices