Page 1 of 1

statics of temp triggers

Posted: Sat Oct 31, 2020 6:54 pm
by zhenzh
I find killTrigger() do delete the created temp trigger but the count of trigger report in statics will not get decreased.
Is that mean killTrigger() will not physically delete a temp trigger and allocated memory can not be released until reload the whole LUA env?

Re: statics of temp triggers

Posted: Sat Oct 31, 2020 7:16 pm
by zhenzh
I have such question because I find reload module spends quiet a long time(even get the mudlet hung) each time my robot keep on running for several days(a lot of temp triggers add/remove occurred)

Re: statics of temp triggers

Posted: Sun Nov 01, 2020 5:14 pm
by Vadi
They're deleted in bulk when the next line is processed, as an optimization.

Re: statics of temp triggers

Posted: Mon Nov 02, 2020 4:51 am
by zhenzh
I may find the root cause of mudlet hung during reload process.
The issue can be easily reproduced by the command below:

Code: Select all

for i=1,50000 do
  id = tempTrigger("test", "")
  killTrigger(id)
end
resetProfile()
reloadModule(<test module>)
I think the issue is introduced by the function reloadModule(). The above issue reproduce can be avoided if I change the code to:

Code: Select all

for i=1,50000 do
  id = tempTrigger("test", "")
  killTrigger(id)
end
uninstallModule(<test module>)
resetProfile()
installModule(<test module.xml>)
Besides, the resetProfile() has another issue that mudlet may get crash if directly running reloadModule() without resetProfile() before it.

Re: statics of temp triggers

Posted: Mon Nov 02, 2020 8:00 am
by Vadi
OK, put it on https://github.com/Mudlet/Mudlet/issues/new please with a module to reproduce it with.