r/ProgrammerHumor • • Jan 16 '14

[deleted by user]

[removed]

1.3k Upvotes

446 comments sorted by

View all comments

Show parent comment

4

u/8lbIceBag Jan 17 '14

It's really a technicality and not a big deal at all! I was joking. But your way would be ideal on an embedded system. Or even better, a ring buffer. For Java though, I'm not sure how it all works behind the scenes and if one way truly is better than the other.

The reason why it would cause a problem on a low level system is that there isn't garbage collection. It would probably lead to a memory leak due to constantly reallocating the memory. Depends on how the compiler optimizes and such.