QMetaType: use sized delete to deallocate a value
When destroying a value created by QMetaType::create(), pass the size to operator delete. This allows allocators to potentially optimize the deallocation. The size passed is always the one used during allocation, iface->size. As a drive-by, make the operator() function const. Change-Id: I3224af525671d98327d21033d059f52620fbb837 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
bee20b2137
commit
44b5602536
@ -74,12 +74,12 @@ namespace {
|
||||
struct QMetaTypeDeleter
|
||||
{
|
||||
const QtPrivate::QMetaTypeInterface *iface;
|
||||
void operator()(void *data)
|
||||
void operator()(void *data) const
|
||||
{
|
||||
if (iface->alignment > __STDCPP_DEFAULT_NEW_ALIGNMENT__) {
|
||||
operator delete(data, std::align_val_t(iface->alignment));
|
||||
operator delete(data, iface->size, std::align_val_t(iface->alignment));
|
||||
} else {
|
||||
operator delete(data);
|
||||
operator delete(data, iface->size);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user