[Development] QtCore missing check for memory allocation
Koehne Kai
Kai.Koehne at theqtcompany.com
Fri Feb 27 11:56:56 CET 2015
> -----Original Message-----
> From: development-bounces+kai.koehne=theqtcompany.com at qt-
> project.org [mailto:development-
> bounces+kai.koehne=theqtcompany.com at qt-project.org] On Behalf Of
> Robin Burchell
> Sent: Friday, February 27, 2015 11:47 AM
> To: development at qt-project.org
> Subject: Re: [Development] QtCore missing check for memory allocation
>
> On Fri, Feb 27, 2015 at 9:20 AM, Oswald Buddenhagen
> <oswald.buddenhagen at theqtcompany.com> wrote:
> >> The argument is that it implies runtime overhead. See Robin's email
> >> for numbers. This is asking for making the code slower on the very
> >> devices where it needs to run faster.
> >>
> > i don't trust this number. i don't know how qMalloc was implemented,
> > but there is no way a simple forwarding wrapper would add 10% overhead
> > to malloc (esp. in an optimized build).
> > modern processors even have a specific optimization for call
> > forwarding (or whatever it's called properly).
qmalloc and friends where implemented in qmalloc.cpp. That is, they can't be inlined, and every call to it from another library will be a cross-library one.
A inlined, header-only wrapper should get away with this.
Regards
Kai
More information about the Development
mailing list