3 ms·
> No GC How does that improve upon Go? Memory safety is much harder without a GC
by mhh__ 7y ago
> No GC
How does that improve upon Go? Memory safety is much harder without a GC
- botto 7y agoIsn't it usually game programmers who advise against GC because you can't predict when it will run and the performance impact it will have.
- mhh__ 7y agoGame programmers and also people who seem to think that Garbage Collection involves burning babies and the hundreds of academics and engineers working on it are somehow doing it out of spite. There are reasons not to use a Garbage Collector but 99% of the time they are absolutely fine if you understand what your particular GC does and does not do
- gbear605 7y agoGCs 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.
- FpUser 7y agoIt is not in my opinion. With modern development tools/frameworks providing memory leaks detection I have completely forgotten when was the last time that my programs leaked memory. And I write complex high performance game servers that run for months non stop. You just have to acquire certain culture/behavior when writing code.
- crimsonalucard 7y agoWhat languages/tools/frameworks/behavior are you using to develop these game servers with no leaking memory?
- gravypod 7y agoI've found valgrind and the clang static analysis tools to be a pretty nice combo.
- FpUser 7y agofor c/c++ I use Visual Leak Detector and Valgrind. For Delphi/FreePascal/Lazarus there are built-in tools and also MadExcept . Behavior/patterns are different depending on task/language but generally when writing code if I want to allocate anything I first write deallocation code.
- NoOn3 7y agoWhat tools for memory leaks detection you can suggest?
- mhh__ 7y agoValgrind (Which also has a bunch of other stuff like cachegrind, which can be a godsend if you are getting telltale cache/branch prediction issues but you can't find where etc.). Clang/GCC both have suites of sanitizers which are usually excellent and easy to grok, these are also available in many language frontends based on LLVM (and maybe GCC?) You can just throw every tool you can find at your CI if you're paranoid, too.
- mhh__ 7y ago