This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

memory leak

Help for those learning Tcl or writing their own scripts.
Post Reply
b
bsdkid
Voice
Posts: 16
Joined: Wed Nov 02, 2005 1:04 am

memory leak

Post by bsdkid »

problem solved. thanks guys!
Last edited by bsdkid on Sun Dec 11, 2005 12:12 am, edited 2 times in total.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

I don't see anything that should cause a memory leak.
for only 1 team per nick, you should do a lsearch for the nick in the array like:
lsearch -exact [array get ::team] $n

PS: reading the rest of the srcipt and the TCL manual is everything you need to know to insert that code.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

I'm fascinated as to how one who is apparently ignorant of Tcl could determine there was even a "memory leak". :|
Last edited by Alchera on Thu Dec 08, 2005 12:03 am, edited 1 time in total.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
b
bsdkid
Voice
Posts: 16
Joined: Wed Nov 02, 2005 1:04 am

Post by bsdkid »

Thank you De Kus!
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

i dont exactly know if it will work on teams with more than 1 nick. I dont have the time to check exactly how array get will look like. you could use -glob and *$n* instead than, but that might lead into wrong matchs again :D. making it absolutely misstake proof you would probably need to lsearch the sublist in a foreach loop :D.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
b
bsdkid
Voice
Posts: 16
Joined: Wed Nov 02, 2005 1:04 am

Post by bsdkid »

hey man, how do i remove nick in team array?
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

XplaiN but think of me as stupid
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

thats not what he is looking for.

thats how far we got yesterday:

Code: Select all

Dez 09 04:58:26 EvilMan	set refresh [lsearch [array get ::team] $nick]
Dez 09 04:58:28 EvilMan	  set a [array get ::team]
Dez 09 04:58:28 EvilMan	  set remove [lsearch -all -inline -glob [lindex $a $refresh] *$nick*]
Dez 09 04:58:28 EvilMan	  set ::team([lindex $a [expr {$refresh - 1}]) [lreplace [lindex $a $refresh] $remove $remove]]
Dez 09 05:00:38 De_Kus	dont use -all and -inline ^-^
Dez 09 05:01:34 EvilMan	 Tcl error [partteam]: bad index "0)": must be integer or end?-integer?
Dez 09 05:02:46 De_Kus	have you a close brake behind the lsearch  statement? :P
Dez 09 05:03:25 EvilMan	set remove [lsearch -glob [lindex $a $refresh] *$nick*]
Dez 09 05:04:08 De_Kus	look at the completet error, maybe you are missing something again :D
Dez 09 05:04:47 EvilMan	Currently: bad index "0)": must be integer or end?-integer?
Dez 09 05:04:47 EvilMan	Currently:     while executing
Dez 09 05:04:47 EvilMan	Currently: "lindex $a [expr {$refresh - 1}]) [lreplace [lindex $a $refresh] $remove $remove]"
Dez 09 05:04:47 EvilMan	Currently:     (procedure "partteam" line 9)
Dez 09 05:04:47 EvilMan	Currently:     invoked from within
Dez 09 05:04:48 EvilMan	Currently: "partteam $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Post Reply