Sidetables should not use operator new
or operator delete
.
#58459
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sidetables should not use
operator new
oroperator delete
. This change switches them over toswift_cxx_newObject()
andswift_cxx_deleteObject()
which wrapswift_slowAlloc()
andswift_slowDealloc()
respectively.Why is this important? Because these operators can be overridden globally by code in other modules. Imagine a game that has a custom memory allocator (a common scenario!) The developers of this game may want to have all C++ allocations go through their custom allocator. Now, what happens if they implement the guts of this allocator in Swift (in whole or in part)? Well… better hope you never need to allocate a sidetable while you're in there.