If that would be the case, then my socket could not emit its readyRead signal. But it does so beautifully.
Everything works. But sporadically leaks huge amounts of memory!
The reader and thus the tcpsocket lives in a thread like this:
QntsBlockStreamReader
::QntsBlockStreamReader(QString pName,
QThread* pThread
){
thread = pThread;
if (thread == 0)
{
thread->start();
}
this->moveToThread(thread);
}
void QntsBlockStreamReader::setupDataTCP()
{
nextBlockSize = 0;
connect(dataPortTCP,SIGNAL(connected()),this,SLOT(dataPortConnectedTCP()));
connect(dataPortTCP,SIGNAL(readyRead()),this,SLOT(dataIncomingTCP()));
dataPortTCP->connectToHost(writerAddress,dataPortNo);
}
QntsBlockStreamReader::QntsBlockStreamReader(QString pName,QThread* pThread)
{
thread = pThread;
if (thread == 0)
{
thread = new QThread(this);
thread->start();
}
this->moveToThread(thread);
QMetaObject::invokeMethod(this,"setupDataTCP");
}
void QntsBlockStreamReader::setupDataTCP()
{
nextBlockSize = 0;
dataPortTCP = new QTcpSocket();
connect(dataPortTCP,SIGNAL(connected()),this,SLOT(dataPortConnectedTCP()));
connect(dataPortTCP,SIGNAL(readyRead()),this,SLOT(dataIncomingTCP()));
dataPortTCP->connectToHost(writerAddress,dataPortNo);
}
To copy to clipboard, switch view to plain text mode
I don't think that we are close to a solution here, because this would be a fundamental flaw and not a sporadic leak.
Joh
Bookmarks