| ▲ | CyberDildonics an hour ago | |
The ease of use of smart pointers makes it tempting to allocate/free of temporary structures even within one single function. Given enough number of such occurrences, it kills performance by a thousand cuts. This isn't true and doesn't make any sense. Smart pointers don't need to enter into it. If you need a lot of something you make a vector and allocate once. Also I remember they mentioned it’s not necessary to free memory if you’re about to close your program, because the OS will take the memory back. It is an extremely niche scenario to need a program to shut down so much faster that you can't even deallocate memory. If you don't make lots of small allocations in the first place the deallocations won't take any time. Obviously you need to gracefully deinitialise some things, like audio or other devices, but that’s beyond the discussion. It's actually a pretty big advantage to destructors to deal with stuff like this as well as memory and locks. IMO, their RAII critique is a but nuanced, but because of their personality the discourse often gets polarising. I think it gets polarizing because they are both undeniably sharp programmers but don't have any real evidence of this stuff, they are just grasping at rationalizations. | ||