Disabling explicit GC
Garbage collection is a very CPU-intensive activity; while it is occurring, no application logic can be executed. While the Java API provides a method of invoking the garbage collector from application code, it is best practice to let only the JVM decide when to perform garbage collection. If an application contains explicit calls to System.gc()
, then these can significantly impact performance. Luckily, Java includes a flag that allows us to disable calling the garbage collector programmatically.
Getting ready
This recipe assumes you are using the HotSpot JVM, if you are using JRockit, see the There's moreā¦ section of this recipe for the parameter you need.
For more details, refer to the Getting ready section of Setting the new size recipe.
How to do it...
To disable explicit programmatic garbage collection, perform the following steps:
Navigate to the domain's
bin
directory:cd %MIDDLEWARE_HOME%/user_projects/domains/soa_domain/bin
Open the
setSOADomainEnv.cmd
orsetSOADomainEnv...