Modern Memory Management
Subject:   C++ has garbage collection?
Date:   2005-11-08 11:18:49
From:   orichy
Response to: C++ has garbage collection?

"I didn't know C++ had any more garbage collection than C had. You still need to new/delete memory or objects created on the heap just like malloc/free in C."

It's true that C++ has no garbage collection by default but it has RAII. And i think what the author wanted to say is that in C++ you rarely use new/delete, compared to malloc/free in C because C++ has a good standard library offering all containers one could ever need. :-)

BTW: The author never states, C++ had any gc as you seem to imply.


Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • C++ has garbage collection?
    2005-11-08 11:45:49  Lunchy [View]

    Good points, however, lumping C++ in with Perl and PHP and Java implies the language has GC built-in.

    It's not a big deal, but if I didn't know anything about C++, his statement would lead me to believe C++ has GC comparable to that found in Perl, Java, or PHP without the use of the STL or RAII techniques.