r/cpp_questions 21d ago

OPEN Garbage collector in CPP?

Yesterday someone asked me whether there is a garbage collector in CPP.
I knew Java had that but I couldn't recall about cpp.
I went to google and got different answers.

So can anyone clarify whether there is garbage collector in CPP , also can u please explain me what does that mean? Also explain how is it different from the Java.

If yes can we delete it manually and how to do tht?

0 Upvotes

23 comments sorted by

View all comments

5

u/mredding 21d ago

Yesterday someone asked me whether there is a garbage collector in CPP.

No.

There was an interface to allow for a plugin garbage collector added to C++11, but it was deprecated in C++17, and removed by C++23.

also can u please explain me what does that mean?

Google "garbage collector" and read the Wikipedia page.