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

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_MACHINE\SOFTWARE\Microsoft\Java 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.
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.