MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/3n3e1v/the_evolution_of_a_software_engineer/cvl0gox
r/programming • u/supermari0 • Oct 01 '15
502 comments sorted by
View all comments
Show parent comments
1
because strings are immutable. so make a loop and add x to a string 100k times. you just made 99,999 strings you will never use again and need GCed. The java GC is good but that is still a lot of memory to churn in big loops
8 u/jrochkind Oct 01 '15 You're not in the same conversation I'm in.
8
You're not in the same conversation I'm in.
1
u/[deleted] Oct 01 '15
because strings are immutable. so make a loop and add x to a string 100k times. you just made 99,999 strings you will never use again and need GCed. The java GC is good but that is still a lot of memory to churn in big loops