-
Notifications
You must be signed in to change notification settings - Fork 0
Description
We should evaluate migrating our Metal backend to use Automatic Reference Counting (ARC) for improved memory safety and code maintainability. Current manual memory management in metal_device.mm causes compiler warnings and potential risks.
Proposed Implementation Plan:
Investigation Phase
Benchmark ARC vs manual performance with Metal API calls
Audit all C++/Objective-C boundary crossings
Document all __bridge and CoreFoundation interactions
Experimental Implementation
cmake
CopyInsert
set_source_files_properties(
src/metal/*.mm
PROPERTIES
COMPILE_FLAGS "-fobjc-arc"
)
Create isolated test cases
Verify no leaks using Xcode's Instruments
Full Migration
Replace manual retain/release calls
Update CMake for mixed ARC/non-ARC
Verification Requirements:
✅ Performance tests (allocations/transfers)
✅ Memory leak checks
✅ Backward compatibility
Benefits:
Eliminates memory management bugs
Reduces code complexity
Modern Apple platform alignment
Would you like me to:
Provide this as markdown text you can paste directly?
Suggest someone to assign this to?
Help draft any additional technical details?