MissingNumber
MissingNumber

Reputation: 1182

What are the key factors or good practices that reduce the garbage collection time in Java?

What are the key factors or good practices that reduce the garbage collection time in Java ?

All I know is increasing RAM could be one trick .

What are all the other features which effect it.

Upvotes: 2

Views: 130

Answers (1)

NPE
NPE

Reputation: 500663

There are multiple factors:

  • the type of garbage collector used;
  • collector configuration (e.g. the size of the various sub-heaps);
  • the size and frequency of memory allocations;
  • typical duration of object lifetime.

Java Performance by Hunt et al has some good material on optimizing Java GC for throughput and latency.

If you have a practical problem to solve, using a memory profiler on your program is often a good first step.

Upvotes: 3

Related Questions