4 ms·
Well, technically Swift's memory management is the same as what C++ offers via smart pointers, the only difference is that in C++ it is opt-in (and still very p
by hellofunk 10y ago
Well, technically Swift's memory management is the same as what C++ offers via smart pointers, the only difference is that in C++ it is opt-in (and still very popular). Swift is quite unlike Go or Java's memory management; it is not a GC in the sense that they use it.
- pcwalton 10y agoSwift memory management isn't nearly as expressive as C++ when it comes to references (i.e. unmanaged pointers). You can use in/out/inout parameters on functions and that's about it. I agree with the parent that Swift memory management is basically like Go or Java: everything is GC'd (reference counting being a form of GC).
- themihai 10y agoSwift does have a runtime though. In its current form I can't see it replacing C or C++. It may provide more deterministic performance than Go but it's not C. If it were to be designed as C replacement I would expect a roadmap for embedded environments, praise about its mapping to the hardware, how it trashes or at least matches C/C++ on its application domain(i.e. low level/ hardware interface or performance) etc but it's clear that is not the case and its focus is on "apps" first, servers second and maybe a bit of low level.