[Interest] QObject, PIMPL and overloading operator new

Bo Thorsen bthorsen at ics.com
Fri Aug 16 12:42:26 CEST 2013


Den 16-08-2013 11:34, Peter Koek skrev:
> Suppose that I have objects deriving from QObject and want to control
> their dynamic allocations for performance reasons. I would overload
> operator new to allocate them, for example, into a pool. None of this is
> implemented in any way yet.
> The objects themselves would now be allocated in the pool. However,
> since I didn't overload the operator new of QObjectPrivate it would not
> be allocated into the pool which partly defeats the purpose, as I still
> have a default allocation.
> My question is: can I control the way the private parts of Qt
> (specifically, QObjectPrivate) are allocated?

Not without modifying the Qt sources. It's impossible.

> I'd also like to verify the following statements in the context of an
> LGPL license. I'd like to keep my source closed, so modifying the Qt
> source directly is not possible. I'd also rather not derive my own PIMPL
> object from QObjectPrivate to overload operator new, as it would destroy
> binary compatibility with future versions of Qt5, even when not using
> any of the QObjectPrivate members.

As Konstantin already replied, it's not a problem to supply a modified 
Qt under LGPL. Only the modifications to Qt itself has to be supplied.

But you could also consider a licensed version for this. Then you can 
ship the application any way you like and not worry about it.

Bo.

-- 
Bo Thorsen, European Qt Manager, Integrated Computer Solutions
ICS - Delivering World-Class Applications for Embedded & Mobile Devices
http://ics.com/services



More information about the Interest mailing list