[Development] Deprecation of qMalloc/qFree/qRealloc

Andreas Holzammer andreas.holzammer at kdab.com
Wed Dec 21 16:21:23 CET 2011


Hi Robin,

Am 21.12.2011 07:26, schrieb Robin Burchell:
> Hi,
> 
> I've submitted two changes last night:
> - http://codereview.qt-project.org/#change,11562 - deprecating
> qMalloc/qFree/qRealloc
> - http://codereview.qt-project.org/#change,11563 - removing all uses
> of them from QtBase
> 
> My justification for this change is pretty simple - the only real
> reason to have these as far as I know is that it makes it possible to
> swap out memory allocation across Qt, but, there are usually other
> ways to accomplish this as the commit message notes, and it's rather
> unfair to impose an additional function call on all uses of these for
> something which isn't used in the majority of cases.

I don't think its a good idea to get rid of qMalloc/qFree/qRealloc,
because it is a good starting point for embedded platforms. Many of them
have trouble with memory allocation, if you have one point where you can
change the allocation it is easy to bypass these problems. We had to use
this for a project for Windows CE and I can tell you we where pretty
happy about qMalloc/qFree/qRealloc. It was not used everywhere, but we
where able to fix the others and make the whole allocation through
qMalloc which saved the project. Its something like the QT_NO_*
discussion, its far from ideal, but its a starting point and one can
easily use it.

This is just my point of view in this. But keep in mind that the Qt
embedded market is growing and that stuff like this is needed there.

Thanks,

Andy

> 
> Once these changes go in, I'm happy to submit changes (if any) to other modules.
> 
> Thanks,
> 
> Robin
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development


-- 
Andreas Holzammer | andreas.holzammer at kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4134 bytes
Desc: S/MIME Kryptografische Unterschrift
URL: <http://lists.qt-project.org/pipermail/development/attachments/20111221/4d6df84c/attachment.bin>


More information about the Development mailing list