Memory leak when using PyQt with OpenNMT CTranslate

Giuseppe Corbelli corbelligiuseppe at
Tue Nov 3 10:16:45 GMT 2020

On 10/31/20 3:04 PM, Admin Argos Open Technologies, LLC wrote:
> Hi,
> Thanks for the suggestion. It does seem like making the GUIWindow the 
> parent of the WorkerThreads is correct and that's what they do in Qt's 
> QThread documentation. I also made a change to connect the QThread's 
> finished signal to its deleteLater slot which is what is done in the 
> documentation's example for subclassing QThread. However, neither of 
> these changes fixed the problem and this example is still leaking memory:

Well, I did not try the example but if you subclass QThread you also 
need to call the base class event loop (QThread::run()) or you won't get 
any signal delivery and the thread will exit as soon as the translator 
is created.

Giuseppe Corbelli

More information about the PyQt mailing list