On Fri, 05 Sep 2008 21:48:10 +0200
Magnus Fromreide <[EMAIL PROTECTED]> wrote:

> On Thu, 2008-09-04 at 14:18 -0700, Stephen Hemminger wrote:
> > Reduce snmpd memory usage.
> > 
> > The route table can grow very large and existing code is a major
> > performance problem since it wastes half of its memory and copies
> > each time.
> >     
> > 1. Grow expanding table by 1.5 rather 2x per step
> 
> You need to make sure that the table grows at all.
The N is always 10 or larger so it will increase: 10 15 22 33 ...

> Additionally, at the moment the table never shrinks, I think that is a
> obvious potential improvment for memory usage.

For most usages, table is loaded from some source once, and never shrinks.

> 
> >    Perhaps the increment should just be PAGESIZE
> 
> This is interesting - the effect is that it changes the insert from O(n)
> to O(n*n) but for small tables I think it would be a gain anyway and you
> do avoid the problem of the big growth.
> 
> > 2. Use realloc rather than copying, this allows for possible
> >    inplace growth and smart allocation.
> 
> This I think sounds like an excellent idea and it do lessen some of the
> +PAGESIZE cost.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to