How can I configure when the Microsoft Java Virtual Machine (JVM) initiates Java garbage collection?

John Savill

April 10, 2003

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. The Java programming language frees programmers from having to remember which memory areas they've allocated so they don't need to free those areas when the function is finished using them. In Java, the runtime environment uses the garbage collection process to automatically free memory when it's no longer needed, but this process uses resources while it's running. With JVM build 3229 and later, you can configure the garbage collection process to run only after a certain amount of memory has been allocated to Java. To do so, perform the following steps:

  1. Start a registry editor (e.g., regedit.exe).

  2. Navigate to the HKEY_LOCAL_MACHINESOFTWAREMicrosoftJava VM registry subkey.

  3. From the Edit menu, select New, DWORD Value.

  4. Enter the name Generation0Size, then press Enter.

  5. Double-click the value, set it to the number of bytes that must be allocated to Java before you want the garbage collection process to run, then click OK.

  6. Close the registry editor.

  7. Restart the machine for the change to take effect.

Read more about:

Microsoft

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like