diff options
| author | Aurélien Brooke <aurelien@bahiasoft.fr> | 2025-07-26 09:22:36 +0200 |
|---|---|---|
| committer | Aurélien Brooke <aurelien@bahiasoft.fr> | 2025-07-28 13:02:09 +0200 |
| commit | 0cc4772bf90af07064d451d7284548dd11694994 (patch) | |
| tree | 961d99dfd97ba6f4760004dbf68580502c5f0232 /src/corelib/kernel/qobject.cpp | |
| parent | b09b148837db96e6c788cf05e3e46ef904ae20c6 (diff) | |
QQueuedMetaCallEvent: use sized-free to dealloc args_
We are only one multiplication by 16 (PtrAndTypeSize) away from the
allocSize, so compute it to speed up the deallocation for compatible
allocators such as jemalloc.
Amends b7d073e9905bf9812ba96cecdcf6871a95517d30.
Change-Id: I959e5db308381bb8012511b37c99d93f486d66e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
| -rw-r--r-- | src/corelib/kernel/qobject.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 980fefc4eae..aa429636bd3 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -622,7 +622,7 @@ QQueuedMetaCallEvent::~QQueuedMetaCallEvent() } if (d.nargs_) { if (static_cast<void *>(d.args_) != prealloc_) - free(d.args_); + QtPrivate::sizedFree(d.args_, d.nargs_, PtrAndTypeSize); } } @@ -634,9 +634,8 @@ inline void QQueuedMetaCallEvent::allocArgs() if (!d.nargs_) return; - constexpr size_t each = sizeof(void*) + sizeof(QMetaType); - void *const memory = d.nargs_ * each > sizeof(prealloc_) ? - calloc(d.nargs_, each) : prealloc_; + void *const memory = d.nargs_ * PtrAndTypeSize > sizeof(prealloc_) ? + calloc(d.nargs_, PtrAndTypeSize) : prealloc_; Q_CHECK_PTR(memory); d.args_ = static_cast<void **>(memory); |
