4 ms·
Man! I'd never want to code in language that forces me to manage memory. A boring, solved problem the compiler/run time should handle for me.
by njharman 11y ago
Man! I'd never want to code in language that forces me to manage memory. A boring, solved problem the compiler/run time should handle for me.
- Peaker 11y agoI enjoy both kinds of languages. I do think garbage collectors are overrated. When using certain styles in C or C++, memory management is really a tiny aspect you have to spend a tiny minority of your time thinking about -- but you gain so much determinism of execution in return. I've been burnt by garbage collection killing my programs' performance many times -- having to tune the garbage collector has taken more time than just writing manual memory management in some cases! Also, dynamic memory allocation and garbage collection just injects so much dynamism and uncertainty in your program's execution. I dislike it for the same reason I dislike dynamic typing. I want to be able to statically reason about the resource use of my program, just like I want to statically reason about any other aspect of my program.
- njharman 11y agoDeterministic! My usual coding projects (distributed, networked, multi-process/multi-thread) are so far from determinism and my problems so many levels above the concerns of C/C++. Both are needed. Just saying I'm glad other devs work on the lower level stuff for me ;)
- Peaker 11y agoNon-determinism comes in many forms. I don't think it's an all or nothing thing. Eliminating non-determinism is always nice, even if lots of other non-determinism remains. Having predictable and understandable resource use is a nice plus. Removing dynamic memory allocation also tends to increase locality, remove indirections, and remove error handling paths from your code.
- Sanddancer 11y agoMemory management isn't solved though. In a lot of applications, it takes up a significant amount of memory and/or cpu time, which can be of importance if you have time constraints, space constraints, and/or power constraints. Deterministic memory lets you, for example, know that the 256 bytes on your microcontroller is more than enough, or that you will always hit the timings needed to guarantee that your project will always output at 60 frames per second. Yes, there are a lot of times you can just throw RAM at the problem to make it go away, but there are a lot of really interesting problems out there that do require you to be able to intimately manage resources.