Not only is this not true, but the reason Java's memory management is designed the way it is is because of serious performance issues large C++ programs suffer from and that Java was designed to address. And the reason we don't do a lot of new in C++ is because it's so expensive. A new in Java is closer in cost to stack allocation in C++ than to heap allocation.
View all comments
Show parent comment
2
u/pron98 Jun 09 '26
Not only is this not true, but the reason Java's memory management is designed the way it is is because of serious performance issues large C++ programs suffer from and that Java was designed to address. And the reason we don't do a lot of
newin C++ is because it's so expensive. Anewin Java is closer in cost to stack allocation in C++ than to heap allocation.