Skip to content

-Xlockword

Test whether performance optimizations are negatively impacting an application.

Syntax

    -Xlockword:<parameters>

Parameters

mode

    -Xlockword:mode=all
    -Xlockword:mode=default

Locking optimizations typically reduce memory usage and improve performance. However, there might be some situations where a smaller heap size is achieved for an application, but overall application performance decreases.

For example, if your application synchronizes on objects that are not typically synchronized on, such as Java.lang.String, run the following test:
Use the following command-line option to revert to behavior that is closer to earlier versions and monitor application performance:

-Xlockword:mode=all

If performance does not improve, remove the previous command-line options or use the following command-line option to reestablish the new behavior:

-Xlockword:mode=default

nolockword

    -Xlockword:nolockword=<class_name>

Removes the lockword from object instances of the class <class_name>, reducing the space required for these objects. However, this action might have an adverse effect on synchronization for those objects.

You should only use this option for troubleshooting.

what

    -Xlockword:what
Shows the current lockword configuration.