Memory leaks are typically the result of a seemingly unbounded growth in the memory usage of a process as reported by the show system processes extensive command.
There are two classes of memory leaks that the routing protocol process can experience:
- The first class occurs when the allocated memory that is no longer in use is not freed. This class of leak can usually be fixed by taking several samples of the show task memory detail command over a period of time and comparing the deltas.
- The second class occurs when there is a late access to freed memory. If the access is not outside the mapped address space, the kernel backfills the accessed page with real memory. This backfill is done without the knowledge of the routing protocol processes internal memory allocator, which makes this class of leak much more difficult to resolve. If a memory leak of this class is suspected, writing the state of the system to a disk file (creating a core file) is suggested.
A large discrepancy between the RES value and the Currently In Use value might indicate a memory leak. However, large discrepancies can also occur for legitimate reasons. For example, the memory used for the TEXT and STACK segments or the memory used by the routing protocol process’s internal memory manager might not be displayed. Further, the RES value includes shared library pages used by the process.
For more information, see Junos OS Routing Protocols Library for Routing Devices