3 ms·
GCs are good for some things and bad for others. I wouldn’t want to write an OS with a GC but I also wouldn’t want to write a web server where I have to manuall
by gbear605 7y ago
GCs are good for some things and bad for others. I wouldn’t want to write an OS with a GC but I also wouldn’t want to write a web server where I have to manually allocate and free memory. It’s all a trade off.
- mhh__ 7y agoYou shouldn't be manually allocating memory anywhere if you malloc and free. I feel quite strongly about the use of C in modern systems code: The "C" way of doing things can often be very unsafe or at least prone to being unsafe (No fault of the programmer, but if you don't provide RAII and things like that by default it becomes too easy to double free or leave bounds unchecked) A kernel doesn't really need a garbage collector, but keep in mind that some modern GCs can literally be tuned to have ms pause times on absolutely enormous heaps which given that reference counting can have unbounded pause times too can make them an enticing option. The real reason to avoid garbage collection is typically memory usage in my experience
- gbear605 7y agoYeah, I was using “manually allocating” as a synonym for malloc and free, but they are actually different things.