[Qt-interest] QSslSocket: massive difference in app memory usage when encryption enabled

Stephen Collyer scollyer at netspinner.co.uk
Wed Jul 15 11:21:42 CEST 2009


2009/7/10 Stephen Collyer <scollyer at netspinner.co.uk>

> I'm using Qt 4.5.0 on Opensuse 11.1
>
> I have an HTTP/HTTPS implementation based on QTcpServer and QSslSocket.
>
> When emitting a file in response to a GET request, memory usage is
> minimal when handling an unencrypted http request. However,
> when handling an encrypted https request, memory usage increases
> dramatically, and I get the impression that Qt is buffering the whole
> file before any writes to the underlying socket takes place.
>
>
I've done some more testing on this problem, and it seems that
when writing a file to an encrypted QSslSocket

a) thw whole file is buffered in memory, until QSSlSocket::close() is
called.

b) the Qt event loop is blocked while the data is being written, despite the
fact that method connected to readyRead() yields to the event loop
regularly.

If the QSslSocket is not encrypted, then none of the above occurs; i.e
the event loop is not blocked, and the file is not buffered in memory.

The difference between the two cases is solely the activation of encryption
in incomingConnection(..).

This looks to me like a fairly major bug in QSslSocket, my only doubt being
that I can't see how Trolltech could not have noticed it already.

-- 
Stephen Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090715/a04a65f9/attachment.html 


More information about the Qt-interest-old mailing list