5 ms·
Some simple habits, like always writing your malloc() and free() calls at the same time in balanced pairs, can make C quite managable. One can also use the Boe
by vezzy-fnord 13y ago
Some simple habits, like always writing your malloc() and free() calls at the same time in balanced pairs, can make C quite managable.
One can also use the Boehm GC if they feel it necessary.
- thinkpad20 13y agoI'm curious as to who uses a garbage collector in C. It seems like if you're using C, you probably are in a situation where you want as close control of that kind of stuff as possible (short of assembly).
- dllthomas 13y agoThe same thing can be said about malloc. It's a matter of degree, and different projects have (sometimes subtly) different requirements.
- dllthomas 13y agoExpanding - in particular, Boehm seems to only run collections on allocations. If your code is structured such that you don't allocate during periods when you need more precise control (already a good idea, if you are using malloc!) then this won't have an impact.
- vezzy-fnord 13y agoGCC and Mono use it internally, I believe. It's a very conservative garbage collector at the end of the day. It can be tweaked so as to be completely bare bones, and the performance impact is very benign. Rather, memory consumption is its weakness.