Bug 294022

Summary: Remove MallocPtr.
Product: WebKit Reporter: Keith Miller <keith_miller>
Component: Web Template FrameworkAssignee: Vassili Bykov <v_bykov>
Status: REOPENED    
Severity: Normal CC: commit-queue, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 296151    
Bug Blocks:    

Keith Miller
Reported 2025-06-04 07:07:56 PDT
We should remove this class, it's just a giant footgun at this point. In particular, if the type doesn't have a destructor it's effectively the same as std::unique_ptr. If it does have a destructor then we should very very likely be running that destructor. Adding `static_assert(std::is_trivially_destructible<T>())` to `MallocPtr` lead me to at least two memory leaks in JSC and who knows how many more in WebCore+. These probably happen because the class didn't need a destructor at first then someone adds a member that needs destruction but `MallocPtr` doesn't complain.
Attachments
Radar WebKit Bug Importer
Comment 1 2025-06-04 07:08:32 PDT
Vassili Bykov
Comment 2 2025-06-12 11:36:24 PDT
EWS
Comment 3 2025-07-17 14:14:39 PDT
Committed 297550@main (a892900ddc21): <https://commits.webkit.org/297550@main> Reviewed commits have been landed. Closing PR #46668 and removing active labels.
WebKit Commit Bot
Comment 4 2025-07-17 15:33:13 PDT
Re-opened since this is blocked by bug 296151
Vassili Bykov
Comment 5 2025-07-22 10:33:36 PDT
Note You need to log in before you can comment on or make changes to this bug.