Version: (using KDE 4.3.0) OS: Linux Installed from: Ubuntu Packages KTorrent with a python kross script, ktorrent calls a method of a class in the script through a Kross::Object::Ptr. The call is done frequently and every few seconds about 100 KB is added to the memory ktorrent is using. How to reproduce: startup ktorrent, load a torrent, load the scripting plugin, enable the tracker grouping script. In the groups tree select a tracker group, and then just wait, and watch memory usage go up. This is the code in ktorrent which calls the method: bool ScriptableGroup::isMember(bt::TorrentInterface* tor) { QVariantList args; QObject* obj = api->torrent(tor->getInfoHash().toString()); if (!obj) return false; args << qVariantFromValue(obj); QVariant ret = script->callMethod("isMember",args); return ret.toBool(); } See plugins/scripting/api/scriptablegroup.cpp in the ktorrent code. Commenting out the script->callMethod line and making the function return true, results in no memory leaks, so this is leaking, only I don't see anything obvious what is causing it in my code, so it must be in the kross python code.
Why in bugzilla is kross a component of kdevplatform ? This isn't a kdevelop bug.
(In reply to comment #1) > Why in bugzilla is kross a component of kdevplatform ? This isn't a kdevelop > bug. Because kdevplatform has kross support. If you want the kross stuff in kdelibs you need to use kdelibs as product.
It seems krosspython is in kdebindings, reassigning to bindings
Relevant valgrind output: ==23249== 2,112 bytes in 132 blocks are possibly lost in loss record 96 of 332 ==23249== at 0x40269EE: operator new(unsigned int) (vg_replace_malloc.c:224) ==23249== by 0xB5D702E: Kross::PythonType<QVariant, Py::Object>::toPyObject(QVariant const&) (pythonvariant.cpp:195) ==23249== by 0xB5FFF37: Kross::PythonObject::callMethod(QString const&, QList<QVariant> const&) (pythonvariant.h:296) ==23249== by 0xB44CD82: kt::ScriptableGroup::isMember(bt::TorrentInterface*) (scriptablegroup.cpp:49) ==23249== by 0x808F4AC: kt::ViewModel::Item::member(kt::Group*) const (viewmodel.cpp:299) ==23249== by 0x80935FE: kt::ViewModel::update(kt::ViewDelegate*, bool) (viewmodel.cpp:370) ==23249== by 0x808CBE1: kt::View::update() (view.cpp:141) ==23249== by 0x809C605: kt::ViewManager::update() (viewmanager.cpp:218) ==23249== by 0x80A0B5B: kt::TorrentActivity::update() (torrentactivity.cpp:243) ==23249== by 0x8083E77: kt::GUI::update() (gui.cpp:476) ==23249== by 0x8087914: kt::GUI::qt_metacall(QMetaObject::Call, int, void**) (gui.moc:120) ==23249== by 0x4ECC1B7: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3113)
assign to me
It happens when you add a QObject pointer to the argument list of callMethod
I see the problem. Guess we need to guard the python object better.
Any news in solution of this problem?
Shameless bump — is there any plan on solving this? I mean KrossPython is quite a common scripting option in KDE for all sorts of things (KTorrent, Plasmoids etc.)
Thank you for the bug report. As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists. If this bug is no longer persisting or relevant please change the status to resolved.