Reputation: 4651
is garbage collection algorithm in java "vendor implemented?"
Upvotes: 5
Views: 1355
Reputation: 1
Yes. The Java VirtualMachine Specification don't say anything specific about garbage collection. Each vendor has their own implementation for performing the task. each can automatically calls garbage collector, then we didn't need manual calls for garbage collection
Upvotes: 0
Reputation: 413
Yes. The Java VM Spec's don't say anything specific about garbage collection. Each vendor has their own implementation for performing GC. In fact, each vendor will have multiple GC policies that can be best chosen for a particular task.
Example A GC tuned for throughput may not be good for real-time systems since they will have erratic (and often longer) pause times which are not predictable. Non-predictability is a killer for real-time application.
Some GC's such as the ones from Oracle and IBM are very tunable and can be tune based on your application's run-time memory characteristics.
The internals of GC are not too complicated at a higher level. Many algorithms that began in the early days of LISP are still in use today.
Read this (http://nd.edu/~dthain/courses/cse40243/spring2006/gc-survey.pdf "GC Introduction") for a good introduction to Garbage Collection at a moderately high-level.
Upvotes: 0
Reputation: 25339
From the introduction paragraph to Chapter 3 of the Java Virtual Machine Specification:
For example, the memory layout of run-time data areas, the garbage-collection algorithm used, and any internal optimization of the Java virtual machine instructions (for example, translating them into machine code) are left to the discretion of the implementor. [emphasis mine]
Upvotes: 6
Reputation: 30448
Yes, and not only that, each JVM can contain more than one garbage collection strategy:
Upvotes: 4
Reputation: 19782
Definitely vendor dependent. GCJ and the Sun VM use totally different garbage collectors, for example.
Upvotes: 1