4 ms·
> This is partly why applications that go to the extreme in the effort not to allocate and end up mutating more. If you go to the extreme and don't allocate, y
by chmod775 6y ago
> This is partly why applications that go to the extreme in the effort not to allocate and end up mutating more.
If you go to the extreme and don't allocate, you can turn the GC off.
- pron 6y agoYes (well, sort of; you could use the Epsilon GC, which is essentially a no-op GC), but I once read of a library that allocated all of its objects at initialisation and claimed to be "GC-neutral", i.e. not add any memory management burden regardless of the GC chosen by the application using it. They were very surprised when they tried running their benchmarks with G1. OpenJDK's modern GCs are optimised for "reasonable behaviour." Allocate too much and you suffer; allocate too little (by which I mean reuse objects and mutate them a lot) and you also suffer. But as long as your behaviour is in the broad more-or-less normal range, you get some really good performance, which is only getting better with each release.