Re: Scotty mem usage growing

Juergen Schoenwaelder (schoenw@gaertner.de)
Fri, 25 Jul 1997 15:10:24 +0200

Sveinar Rasmussen <sveinarr@stud.cs.uit.no> said:

Sveinar> The memory leak doesn't happen if I comment the
Sveinar> following lines of my code:

Sveinar> proc setMIB {var val} {
Sveinar> global s
Sveinar> $s instance $var $var $val
Sveinar> }

I can reproduce the problem - so there is a good chance that it will
be fixed in 2.2.0. Yopu can work around the problem by using the "$s
instance" command only once to establish the connection between the
MIB instance and the Tcl variable. Afterwards, you simply update the
Tcl variable.

Sveinar> So this instance stuff is acting weird. Can I
Sveinar> "uninstance" a variable before updating it?

Yes, just unset the Tcl variable. This actually helps to work
around the memory leak:

proc setMIB {var val} {
global s $var
uplevel #0 $var foo
catch {unset foo}
$s instance $var $var $val
}

(Note that the instances are bound to global variables.)

Sveinar> If I don't do that, obviously, the scotty program get
Sveinar> bigger and bigger until it crashes :( I'm updating the
Sveinar> variables in the HOST MIB-II tree once every 30th
Sveinar> second.

You are updating the variables every 30th second, even if you do not
get SNMP requests? This is definitely a very expensive way to
implement things. It might be OK for your school project, but it is
not acceptable for a real implementation.
Juergen

-- 
Juergen Schoenwaelder <jschon@research.bell-labs.com>   Tel. +1 908 582 6794
Lucent Technologies, Bell Laboratories, Room 2B-422,    Fax. +1 908 582 5809
600 Mountain Avenue, Murray Hill, NJ 07974
--
!! 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.