Hi,

I'm trying to track down a small memory leak, and my main culprits at the
moment are some small 'utility' objects. These objects create a timeout
object (containing the only reference to the object), does some stuff, then
forgets the timeout object. A barebones version of the script looks like
this

property mytimeoutName
property myCounter 

on new (me)
  myCounter = 0
  mytimeoutName = me.string&&"thread"
  timeout(mytimeoutName).new(100, #mProcessThread, me)
end

on mProcessThread (me)
  if myCounter < 10 then
    myCounter = myCounter + 1
    put myCounter
  else
    -- finished doing its thing
    timeout(mytimeoutName).forget()
  end if
end

The only reference to the script object is contained in the timeout object
(which is sufficient to keep the object alive). When the timeout object is
forgotten, then I am assuming that the object will be de-referenced and
effectively destroyed. Does this seem right?

Thanks for any feedback

Luke



[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to