3 ms·
Boehm's a very good garbage collector, given this: > A precise generational collector would perform far better but wouldn't be so easy to drop into a C codebas
by zedshaw 16y ago
Boehm's a very good garbage collector, given this:
> A precise generational collector would perform far better but wouldn't be so easy to drop into a C codebase.
It's that last part that's key. Without language support at even the basic level, you won't get much better.
As for this "precise generational collector", I doubt it. Like everything, saying you need a GC all the time to be safe is just more boogey man fear mongering. You don't need a GC. They're nice yeah. But if you know the application very well then memory management isn't too big a deal.
- aufreak3 16y ago> But if you know the application very well then memory management isn't too big a deal. Agreed. A related case is with Objective-C's memory management scheme which isn't a full GC, but lets you scope your memory allocations. It gets you a level of control that is somewhere between a GC and the kind that boost::shared_ptr does ... neither having the "wait for the trashman" problem that GC brings, nor overdoing the reference count touching like boost can get you into.
- masklinn 16y ago> A related case is with Objective-C's memory management scheme which isn't a full GC, but lets you scope your memory allocations. Obj-C 1 right? I believe Obj-C 2 (on OSX, not iOS) has an optional GC, at least for the objective part. Or would I be wrong?
- mishmash 16y agoYeah, you're right it does. And many of the C-based APIs also have functions to put memory "into" the collector.
- thaumaturgy 16y agoNice to see someone preaching that old time religion.
- modeless 16y agoGC isn't required to be safe, and it doesn't guarantee safety, but it does makes safety a whole lot more likely. Boehm is the best garbage collector given its constraints, but that doesn't make it a good garbage collector overall, or even one worth using. I agree that good GC requires language support; what I disagree with is the attitude that people should use C anyway and forget GC because Boehm isn't good.
- zedshaw 16y agoYou know, you bring up another point: Memory leaks are not a "safety" problem in a web server. Just look at Rails. <rimshot>