[Interest] memory fragmentation?

d3fault d3faultdotxbe at gmail.com
Mon Aug 20 22:55:43 CEST 2012


Interesting thread. I like the bit about allocating everything you could
possibly need at application startup. I tend to do the same thing when
dealing with multiple buffers (never crossed my mind to do it with
widgets), but always wonder if I'm prematurely eja optimizing. Onto my
question: Qt classes and methods in general tend to prefer to allocate
return results behind the scenes instead of letting you pass in an output
buffer. While it makes using Qt faster (typing wise) and easier to use, it
makes the "alloc everything you need at startup" strategy difficult if not
impossible to implement. An example: QCryptographicHash always returns a
new QByteArray. I've mucked about with Crypto++ for example and it lets you
(makes you :-p) pass in the output buffer. This is just one example but I
see the pattern all around Qt. Was this a design decision in Qt early on?
Is it an attempt to KISS? Any suggestions on re-using buffers in those
situations (am I missing something)?

d3fault
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120820/f2ecf6a0/attachment.html>


More information about the Interest mailing list