Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, May 2008
Memory Leak in QFtp::list()


Message 1 in thread

If I take a look to the task-manager under XP the memory usage of my 
program is growing continual. I discovered that the QFtp::list()-command 
is responsible for this growing.
I execute the list-command every 2 seconds and the programm's memory is 
growing by 82kb per list.
I set a break-point in a function connected to commandStartet() and 
commandFinished(). It happens exactly between both signals.
The listInfo()-Signal is not connected to any slot and nothing happens 
in the meantime.
The problem ONLY occurs if the transfer-mode is set to "active".

Is that a known/unknown bug or standard behaviour?
Can anybody reproduce this problem?

I use QT v4.3.4.

--
 [ signature omitted ] 

Message 2 in thread

On Thursday 15 May 2008 09:36:53 sTormtrOOpa wrote:
> If I take a look to the task-manager under XP the memory usage of my
> program is growing continual. I discovered that the QFtp::list()-command
> is responsible for this growing.
> I execute the list-command every 2 seconds and the programm's memory is
> growing by 82kb per list.
> I set a break-point in a function connected to commandStartet() and
> commandFinished(). It happens exactly between both signals.
> The listInfo()-Signal is not connected to any slot and nothing happens
> in the meantime.
> The problem ONLY occurs if the transfer-mode is set to "active".
>
> Is that a known/unknown bug or standard behaviour?
> Can anybody reproduce this problem?

If you can provide a testcase, I can try and run this through valgrind and see 
if I can spot anything.

Cursory glance in QFtp's code has not revealed anything obvious.

-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: This is a digitally signed message part.


Message 3 in thread

Thiago Macieira schrieb:
> On Thursday 15 May 2008 09:36:53 sTormtrOOpa wrote:
>> If I take a look to the task-manager under XP the memory usage of my
>> program is growing continual. I discovered that the QFtp::list()-command
>> is responsible for this growing.
>> I execute the list-command every 2 seconds and the programm's memory is
>> growing by 82kb per list.
>> I set a break-point in a function connected to commandStartet() and
>> commandFinished(). It happens exactly between both signals.
>> The listInfo()-Signal is not connected to any slot and nothing happens
>> in the meantime.
>> The problem ONLY occurs if the transfer-mode is set to "active".
>>
>> Is that a known/unknown bug or standard behaviour?
>> Can anybody reproduce this problem?
> 
> If you can provide a testcase, I can try and run this through valgrind and see 
> if I can spot anything.
> 
> Cursory glance in QFtp's code has not revealed anything obvious.
> 
sure.
just create a QT-Project with a button which includes "gui.h" and calls 
ftp->list() on click().



#include "gui.h"
#include "gui.h"
#include <qDebug>


gui::gui(QWidget *parent, Qt::WFlags flags)
    : QDialog(parent, flags)
{
	ui.setupUi(this);


	ftp = new QFtp(this);
	
	ftp->setTransferMode(QFtp::Active);	//!!!
	
	connect(this->ftp, SIGNAL(commandFinished (int, bool)), this, SLOT(commandFinished(int, bool)));
	connect(this->ftp, SIGNAL(commandStarted  (int)), this, SLOT(commandStarted(int)));
	ftp->connectToHost("ftp.trolltech.com");
	ftp->login();

}

gui::~gui()
{

}


void gui::on_pushButton_clicked()
{
	this->ftp->list();
}
void gui::commandFinished( int id__, bool error___)
{
	if(ftp->currentCommand() == QFtp::List)
	{
	}
	
	if(ftp->currentCommand() == QFtp::ConnectToHost )
	{
	}

	if(error___)
	{
		qDebug() << ftp->errorString();	
	}


}

void gui::commandStarted( int id__)
{
	
}
#ifndef GUI_H
#define GUI_H

#include <QtGui/QDialog>
#include "ui_gui.h"

#include <qFtp>

class gui : public QDialog
{
    Q_OBJECT

public:
    gui(QWidget *parent = 0, Qt::WFlags flags = 0);
    ~gui();

	QFtp	*ftp;



private:
    Ui::guiClass ui;

private slots:
	void on_pushButton_clicked();
	void commandFinished( int id, bool error);
	void commandStarted( int id__);
};

#endif // GUI_H

Message 4 in thread

Hi,

>> If you can provide a testcase, I can try and run this through valgrind 
>> and see if I can spot anything.
>> [...]
> sure.

The provided code doesn't build:
	the main() function is missing
	a *.ui file is missing
	<qFtp> should be <QFtp>
	<qDebug> should be <QtDebug>
The last two issues occur only on case-sensitive platforms.

-- 
 [ signature omitted ]