Script has left several classes in memory...
#1
I'm getting this warning when my script exits:
Code:
09:39:06.525 T:140467688380160 WARNING: CPythonInvoker(7, /home/anto/.kodi/addons/script.squeezeinfo/main.py): the python script "/home/anto/.kodi/addons/script.squeezeinfo/main.py" has left several classes in memory that we couldn't clean up. The classes include: N9XBMCAddon7xbmcgui10DialogBusyE
The script uses WindowXML and I make sure I use "del" when the window closes.

I can also see XBMCAddon and xbmgui DIalogBusy in there. I have created an xbmcaddon instance to get settings etc. but haven't used DialogBusy at all.

Do I need to delete the xbmcaddon instance when I exit too?

Any other ideas how to get rid of this message.

My code is here: https://github.com/elParaguayo/script.squeezeinfo
and the "del" methods can be seen in this commit: https://github.com/elParaguayo/script.sq...1933097473
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#2
Have you tried self.player = None instead of del self.player?

Not sure if it will work, but i know on my script i had the same issue and it was due to using a Player in the same fashion as you.
Since this seems to be built for only kodi 17+ I was not able to install to test
Reply
#3
I can try it, but that is not a kodi Player object. It's a very simple class to get info on a squeezeplayer attached to a Logitech Media Server.

You'd need the server to test the script. You can downgrade the dependency but the skin file would look ugly because the conditional visibilty tests i use only work in Krypton.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#4
(2017-02-19, 17:58)el_Paraguayo Wrote: I can try it, but that is not a kodi Player object. It's a very simple class to get info on a squeezeplayer attached to a Logitech Media Server.

You'd need the server to test the script. You can downgrade the dependency but the skin file would look ugly because the conditional visibility tests i use only work in Krypton.

I don't think it matters if it is a player class. This i just where i discovered it. I have had the issue referencing any class over even custom classes. I can not specifically say this is your cause, but it was the only one i saw referencing a class .
Reply
#5
This was already discussed some time ago. My hypothesis is that reference counting for Kodi classes exposed to Python via SWIG is somehow broken preventing them to be cleaned by Python's Garbage Collector.
As for del operator, despite what the name suggests, by default (unless overloaded) it does not delete an object but decreases its reference counter by 1. Normally, it is enough for the object to be cleaned by the GC, but if the reference counter is screwed simple applying del won't help.

Bottom line: nothing can be done at Python level.
Reply
#6
Fair enough - I'll just ignore it!

Thanks to both of you for your comments.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#7
i faced similar problem when a c level object is referenced to pythonic object, gc would not be able to clean it up. ie:

Code:
import xbmcgui
class myclass(object):
    def __init__(self):
        self.dia = xbmcgui.Dialog()

when script ends, gc collects myclass but leaves xmcgui.Dialog as garbage, after several runs may be a day os so, it would lead kodi to crash.

i had worked around by not referencing kodi c objects to my pythonic objects.

hope that helps
Reply

Logout Mark Read Team Forum Stats Members Help
Script has left several classes in memory...0