[c-nsp] Possible BGP memory leak?

Oliver Boehmer (oboehmer) oboehmer at cisco.com
Tue Aug 21 01:44:31 EDT 2007


Ed Ravin <mailto:eravin at panix.com> wrote on Tuesday, August 21, 2007
7:26 AM:

> On Tue, Aug 21, 2007 at 07:10:08AM +0200, Oliver Boehmer (oboehmer)
> wrote: 
>> Ed Ravin <> wrote on Tuesday, August 21, 2007 3:29 AM:
>> 
>>> On a 7513 router running 12.0(S), we're running rather low on
>>> memory. Yes, I know of the futility of fitting two full Internet
>>> feeds into 256M, and I'm working on that, but in the meantime, this
>>> looks weird: 
>>> 
>>> Router# show proc mem | inc Hold|BGP
>>>  PID TTY  Allocated      Freed    Holding    Getbufs    Retbufs
>>>  Process 151   0  320352144  140361924  178607164          0
>>>  0 BGP Router 152   0     328008     619156       6984          0
>>>  0 BGP I/O 153   0          0     673324       9984          0 0
>>> BGP Scanner 
>>> 
>>> Is the "BGP Router" process really holding 178 MB of memory?  Why
>>> does it only seem to be 51 MB in the listing below?
>>> 
>>> Router# show ip bgp summary
>>> [...]
>>> 185673 network entries using 20981049 bytes of memory
>>> 369703 path entries using 19224556 bytes of memory
>>> 73675/35141 BGP path/bestpath attribute entries using 9725100 bytes
>>> of memory 63197 BGP AS-PATH entries using 1662392 bytes of memory
>>> 4 BGP community entries using 96 bytes of memory
>>> 0 BGP route-map cache entries using 0 bytes of memory
>>> 0 BGP filter-list cache entries using 0 bytes of memory
>>> BGP using 51593193 total bytes of memory
>>> BGP activity 522211/336538 prefixes, 1394152/1024449 paths, scan
>>> interval [...]
>> 
>> The memory reported by "show ip bgp summary" only counts pure BGP
>> data structures. The total memory allocated by the BGP router process
>> includes RIB and CEF structures as it's the BGP router who installs
>> the routes into the RIB/FIB. So the above looks expected..
> 
> But I still suspect there's a memory leak somewhere since after I did
> "no router bgp" and then re-added the original BGP config, the new
> BGP process was using about 20 MB less memory even though the number
> of prefixes/paths hasn't changed much:

BGP allocates memories in chunks, so it does not necessarily consume all
memory it allocated all the time. Please observe the memory consumption
over time, and unless it increases continuously (with a somewhat steady
prefix count), you likely don't have a leak..

	oli


More information about the cisco-nsp mailing list