0

Because of their efficiency, most of the Garbage Collector algorithm are inoffensive in a lot of applications. The "collection" of objects does however require a small overhead cost in order to scan the stack and to liberate non referenced object from the heap.

I know one part of the answer is "it depends". However, I would like to know the kind of projects you have worked on, in any programming language supporting automated heap memory allocation, for which the Garbage Collector was not an option or became a concern.

2 Answers 2

2

I have been using garbage collected languages professionally for over 15 years (and programming for 30 years). My industrial projects have ranged from software collating data from 8,000 tranducers across an oil field to (soft) real-time visualization and low-latency algo trading software.

I found garbage collection to be useful in all cases. I had reservations about the latency of garbage collection in two major projects: the visualization software (in OCaml) and the algo trading software (in F#). However, my concerns proved to be unjustified as the garbage collected solutions actually exhibited better latency characteristics than non-garbage collected solutions in both cases. In particular, translating visualization software from C++ to OCaml actually improved the worst-case stalls by a factor of 5. The stalls in the C++ code were due to collections falling out of scope and reference counts causing avalanches of destructors calling destructors. We had spent considerable effort trying to solve this problem by writing custom allocators that would make destruction incremental but never succeeded. Additionally, we have found that purely functional data structures often exhibit excellent latency characteristics and they are basically intractable without a garbage collector.

The only notable exceptions to my "garbage collectors are good" moral are poor man's garbage collectors like reference counting and conservative garbage collectors like Boehm's GC. I would not touch them with a barge pole in a professional context.

1

I'm currently working on a program in Haskell, which create Direct-Acyclic-Graph (DAG) using 16 traces files from a MPSoCs simulation. each file has over 115 MB and actually my solution require storing all those files in memory in list form, in order to construct DAGs,

I think that in this situation Garbage collector will be a very good partner to improve efficiency of my program, since actually I really need to store those file in memory

2
  • I would love to hear about the performance of your program with and without GC. Have you already started it? What programming language have you chosen?
    – jdecuyper
    Sep 26, 2010 at 16:06
  • 1
    the performances was very bad, since I loaded all the 16 files in memory before using them, but now i'm working on another way to solve the problem, by using files in Haskell's lazyness way, part by part. this will enable garbage collector to free parts which have being already compute out of the memory Sep 26, 2010 at 21:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.