javagc (forced execution of garbage collection)

Format

javagc [-i|-f] [-v] [-s] [-force] [-ehgc] -p process-ID

Function

This command executes full garbage collection at a desired time for the Java process whose process ID is process-id, such as when a memory leak or system error has occurred, or when application debugging is to be performed. Also, executes the full garbage collection and the Explicit memory block release at any time, for the Java process with the specified process- ID.

The SIGQUIT signal is used for communicating with a Java process. When the command is executed, requests user to check the process contents of the command. When the response is n (do not generate, execute, or send), the command does not execute the process contents of the command (the return value is 1). You can omit this configuration step by specifying the -f option.

If a copy garbage collection or a full garbage collection that occurs because of normal causes is running in the java process indicated by process-ID, you wait for the garbage collection to end, and then execute the command.

Arguments

-i
Does not ask the user to check the process contents of the following command:
  • Whether the garbage collection is performed for the process given in process-ID (in Windows)
  • Whether to execute the Explicit memory block release for the process given in process-ID
  • Whether to send the SIGQUIT signal for generating the garbage collection (in UNIX)
A specification of the -f option before the -i option is ignored.
-f
Does not ask the user to check the process contents of the following command:
  • Whether the garbage collection is performed for the process given in process-ID (in Windows)
  • Whether to execute the Explicit memory block release
  • Whether to send the SIGQUIT signal for generating the garbage collection (in UNIX)
A specification of the -i option before the -f option is ignored.
-v
If the -XX:+HitachiVerboseGC option is not specified, creates a Java VM log file according to the Java VM log file creation rules and outputs the extended verbosegc information.
In such cases, output the extended verbosegc information of the contents, also with the effect of the following option values:
  • -XX:+HitachiVerboseGCPrintDate
  • -XX:+HitachiVerboseGCPrintCause
  • -XX:+HitachiVerboseGCCpuTime
  • -XX:+HitachiCommaVerboseGC
-s
Outputs the extended verbosegc information to the standard output.
In such cases, -s outputs the extended verbosegc information of the contents in which the following option values are also reflected:
  • -XX:+HitachiVerboseGCPrintDate
  • -XX:+HitachiVerboseGCPrintCause
  • -XX:+HitachiVerboseGCCpuTime
  • -XX:+HitachiCommaVerboseGC
-force
Executes the garbage collection or the Explicit memory block release for the java process indicated by the process ID that is specified in the -p option, without confirming the existence of the /tmp/hsperfdata_user-name/process-ID file created in the java process.
Note that this option is for UNIX.
-ehgc
Executes the full garbage collection and the Explicit memory block release for the Java process with the specified process-ID. For the Explicit memory block release, see 8.9 Explicit memory block release by the javagc command in the uCosminexus Application Server Expansion Guide.
-p process-id
Specifies a process ID for which a full garbage collection or the Explicit memory block release is to be executed.

For the Hitachi-specific Java VM extension options, see the following locations:

Return values

0:
The command terminated normally.
1:
The command terminated abnormally.
2:
A response indicating that garbage collection was completed was not received within the specified amount of time.

Input examples

  1. Execution of the javagc command, with the -i option specified:

    javagc -i -v -p 8326

  2. In Windows, a message asking whether garbage collection is to be executed is displayed; in UNIX, a process ID confirmation message is displayed:
    • In Windows:
      Force VM to execute GC ? (y/n)
    • IN UNIX:
      send SIGQUIT to 8326:?(y/n)
  3. In Windows, enter y to execute garbage collection or n to not execute garbage collection; in UNIX, enter y to send the SIGQUIT signal or n to not send the signal:
    • In Windows:
      Force VM to execute GC ? (y/n)y
    • In UNIX:
      send SIGQUIT to 8326:?(y/n)y

Output example

[VGC]<Wed Mar 17 00:42:30 2004>(Skip Full:0,Copy:0)[Full GC 149K->149K(1984K), 0.0786038​ secs][DefNew::Eden: 264K->0K(512K)][DefNew::Survivor: 0K->63K(64K)][Tenured: 85K->149K(1408K)][Perm: 1300K->1300K(1536K)][cause:JavaGC Command]

Output messages

Table 10-7 Messages output by the javagc command (in Windows)

No.Error messageExplanation
1usage: javagc [-f|-i] [-v] [-s] [-ehgc] -p process-idAn argument specified in the javagc command is invalid.
2javagc: illegal option --optionThe indicated option (option) specified in the javagc command arguments is invalid.
3javagc: can't communicate with process process-idCommunication with the process specified in the javagc command was not possible because the process has a problem or an error occurred in communication.
4process-id: Not owner0 was specified in process-id specified in the javagc command.
5process-id: Now processing previous request, this request canceledThe process indicated by process-id specified in the argument of the javagc command is currently executing the garbage collection using the previous javagc command. The javagc command cancels the garbage collection execution request.
6javagc: can't create work file at temporary directory, this request canceledThe user does not have permission to reference or write data into the temporary file directory, so a garbage collection request file cannot be created. This garbage collection execution request is cancelled.
7javagc: can't get temporary directory, this request canceledThe temporary file directory could not be extracted, so a garbage collection request file could not be created. This garbage collection execution request is cancelled.
8javagc: unexpected error occurred:error-causeAn unexpected error occurred during javagc command execution.
The following are examples of causes that may be displayed in error-cause:
  • When work memory could not be allocated:
    malloc systemcall fail (errno=Y)
  • When an object could not be closed:
    close systemcall fail (errno=Y)
9process-id: Timeout occurred. Java process not responding.The process indicated by process-id specified in the javagc command did not return a response indicating that garbage collection was completed within the specified amount of time. Or, the indicated process is not a Java process.
10javagc: please delete name-of-undeleted-file in full-path-of-undeleted-fileWhen the javagc command terminated, it could not delete an internal file. Delete the indicated file on the indicated full path.

Table 10-8 Messages output by the javagc command (in UNIX)

No.Error messageExplanation
1javagc [-f|-i][-v][-s] [-ehgc] [-force] -p process-idAn argument specified in the javagc command is invalid.
2javagc: illegal option --optionThe indicated option (option) specified in the javagc command arguments is invalid.
3process-id: No such processThe process indicated by process-id specified in the argument of the javagc command is not found or the process indicated by process-id specified in the javagc command is not the java process.
4process-id: Not ownerThe executing user is not the owner of the process indicated by process-id specified in the javagc command.
5process-id: Now processing previous request, this request canceledThe process indicated by process-id specified in the argument of the javagc command is currently executing the garbage collection using the previous javagc command. The javagc command cancels the garbage collection execution request.
6javagc: can't create work file at /tmp, this request canceledThe user does not have permission to reference or write data into /tmp, so a garbage collection request file cannot be created. This garbage collection execution request is cancelled.
7javagc: unexpected error occurred:error-causeAn unexpected error occurred during javagc command execution.
The following are examples of causes that may be displayed in error-cause:
  • When work memory could not be allocated:
    malloc systemcall fail (errno=Y)
  • When an object could not be closed:
    close systemcall fail (errno=Y)
8process-id: Timeout occurred. Java process not responding.The process indicated by process-id specified in the argument of the javagc command does not return a response indicating that the garbage collection is completed within the fixed time.
9javagc: please delete name-of-undeleted-file in full-path-of-undeleted-fileWhen the javagc command terminated, it could not delete an internal file. Delete the indicated file on the indicated full path.

Notes