| I agree with you, but in this > std::string x = "Hello, " + fullname; // cpu cycles spent on GC you are already spending cycles on memory management (if C++ allocates character data on the heap which I think it does). You are searching for free space in the heap, possibly synchronising to do that, and so on. With a GC you may even use less cycles here! For example a copying GC could mean that you can allocate with a simple thread local bump pointer. So in your statement you are already paying an unknown cycle cost for memory management. Why do you care if it's GC? Your answer is probably the variance in the number of cycles - the noticeable pauses - which is a reasonable concern. |
This is one of the bigger reasons people use C++ and even techniques within it to explicitly collect such items at a known point in time. (Techniques such as marking items as dead in an array but still keeping them in there until the end of frame, etc)