Re: Scotty mem usage growing

Sveinar Rasmussen (sveinarr@stud.cs.uit.no)
Fri, 25 Jul 1997 15:10:15 +0200 (METDST)

On Fri, 25 Jul 1997, Cary B. O'Brien wrote:

> >
> > Hi there,
> >
> > I'm writing my own little SNMP Agent using Scotty v2.1.5. The objective
> > is to support the HOST MIB-II tree on various platforms (school work).
> >
> > However, once my agent has been running for a while (say 24 hours),
> > the scotty process memory usage gets huge. In fact, I "don't have
> > memory to fork off process" then and the program crashes :) It uses
> > a small program to do some low-level snooping (syscalls).
> >
> > The memory leak doesn't happen if I comment the following lines of
> > my code:
> >
> > proc setMIB {var val} {
> > global s
> > $s instance $var $var $val
> > }
> >
>
> Are you doing this once, per instance, on startup, or all the time?
> I _think_ you should only do this during startup to define the instances
> that the agent will respond to.
>

I am doing this _every_ single time I update the dynamic variables. Guess
that's real bad and causing the problem :-) Upgraded to Scotty 2.1.6, but
the memory problem didn't go away... (hihi :)
However, I've made myself a global array that keeps the variables in the
MIB (that are set). If I just update a variable in the array (using set)
it is not automatically reflected in the SNMP retrieval.

Modified my code to do an "instance" once on startup for each particular
variable (and not "instance" every time eating my memory). Like this:

proc setMIB {var val} {
global s allVars
if {![info exists allVars($var)]} {
set allVars($var) $val
$s instance $var allVars($var) $val
} else {
set allVars($var) $val
}
}

Unfortunately, none of the variables in the MIB are updated now :) hehe...
Is there anyone who can tell me the way to update variables in the MIB
tree? I would be delighted :)

> > So this instance stuff is acting weird. Can I "uninstance" a variable
> > before updating it? If I don't do that, obviously, the scotty program
> > get bigger and bigger until it crashes :( I'm updating the variables in
> > the HOST MIB-II tree once every 30th second.
> >
> > Does anyone have a clue what has gone wrong here? Does Scotty v2.1.6
> > fix the problem? Please anyone?
> >
>
> I haven't seen a memory leak with our SNMP agent yet, but I'll keep
> looking.
>

That's because it's not written by a newbie :)

_______________________________________________________________________
| Sveinar Rasmussen -*- Attend master of comp.sci. engineering course |
| sveinar@rasmussen.org -*- http://www.cs.uit.no/~sveinarr/ |

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.