java - Why garbage collector stops all the threads before reclaiming the memory -
i reading performance related post, , encountered sentence "java's garbage collector stops threads before reclaiming memory, performance issue". tried find on google, not.
could please share can clear this?
in principle don't have to. writing , using concurrent garbage collector is
- incredibly complex
- requires more breathing room operate efficiently, may not acceptable on memory-constrained devices
- incurs significant performance overhead. end trading throughput (cpu cycles spent in mutators vs. cpu cycles spent in collector threads) improved (zeroish) pause times. may acceptable deal on large heaps , many-core machines provide interactive services, may not acceptable on small devices or services batch processing.
conversely implementation using stop world pauses simpler , more efficient in terms of cpu utilization downside there pauses.
additionally have consider pause times can low on small heaps if we're using humans yardsticks. low-pause/pauseless collectors worth if either have system smaller tolerances humans or larger heaps, has historically been rare , become more common computers kept growing.
to avoid diving details let's consider reference counting instead of mark-sweep-compact collectors. there concurrent reference counting incurs overhead of atomic memory accesses , potentially more complex counting schemes higher memory footprints.
Comments
Post a Comment