Re: OT:C/C++ Opinion Poll



Vladimir Vassilevsky <antispam_bogus@xxxxxxxxxxx> wrote:

C++ doesn't have garbage collection, unless you use a 3rd party library.

A language with pointers can't have garbage collection. C++ without
pointers and with garbage collection is called Java.

That is simply not true.

GC in general with C or C++:

http://developers.sun.com/solaris/articles/libgc.html

The GC gurus page:

http://www.hpl.hp.com/personal/Hans_Boehm/gc/

"Performance of the nonincremental collector is typically competitive with
malloc/free implementations. Both space and time overhead are likely to be
only slightly higher for programs written for malloc/free (see Detlefs,
Dosser and Zorn's Memory Allocation Costs in Large C and C++ Programs.) For
programs allocating primarily very small objects, the collector may be
faster; for programs allocating primarily large objects it will be slower.
If the collector is used in a multithreaded environment and configured for
thread-local allocation, it may in some cases significantly outperform
malloc/free allocation in time."

(for the people think that GC implies a problem in performance; there are
even JVM implementations for hard real-time systems, where there is a
guaranteed upper bound for GC CPU usage, though these seem to be
implementations done in the research, at least last time when I looked)

--
Jyrki Saarinen
http://koti.welho.com/jsaari88/

.



Relevant Pages

  • Re: OT:C/C++ Opinion Poll
    ... A language with pointers can't have garbage collection. ... Dosser and Zorn's Memory Allocation Costs in Large C and C++ Programs.) ... programs allocating primarily very small objects, the collector may be ...
    (comp.arch.embedded)
  • Re: Garbage collection
    ... What exactly would this garbage collection be required to do? ... A conservative collector cannot reliably ... pointers but aren't), and may discard non-garbage data if pointers ...
    (comp.std.c)
  • Re: Garbage collection
    ... What exactly would this garbage collection be required to do? ... A conservative collector cannot reliably ... pointers but aren't), and may discard non-garbage data if pointers ...
    (comp.std.c)
  • Re: Garbage collection
    ... A conservative collector cannot reliably ... pointers but aren't), and may discard non-garbage data if pointers ... the value of p can contain garbage, and that garbage *could* be interpreted as a pointer. ... in a cell allocator, we just locate the right part of the heap, and the cell, and skim backwards until we hit the first cell in the object. ...
    (comp.std.c)
  • Re: GC in Ada
    ... implementations can provide it). ... Only that C++ does not have pragma Controlled to switch the collector ... problems which brings the "all is pointer" concept of Java. ...
    (comp.lang.ada)