Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7700851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:50:36+00:00 2026-05-31T22:50:36+00:00

In Java, assume 3 java application running. a) Firstly, My application running b) Secondly,

  • 0

In Java, assume 3 java application running.

a) Firstly, My application running

b) Secondly, Not made by me java application running

c) Thirdly, Not made by me java other applications running

d) Fourthly, another application by me running this following method:

  public static void printGCStats() {

    long totalGarbageCollections = 0;
    long garbageCollectionTime = 0;
    for(GarbageCollectorMXBean gc : ManagementFactory.getGarbageCollectorMXBeans()) {

        long count = gc.getCollectionCount();

        if(count >= 0) {
            totalGarbageCollections += count;
        }

        long time = gc.getCollectionTime();

        if(time >= 0) {
            garbageCollectionTime += time;
        }
    }

    System.out.println("Total Garbage Collections: "
        + totalGarbageCollections);
    System.out.println("Total Garbage Collection Time (ms): "
        + garbageCollectionTime);

  }

Question is: d) will show only d garbage collection details or, it will show all including a + b + c +d ? And once i request System.gc or runtime.gc will it request to single or all of them?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:50:37+00:00Added an answer on May 31, 2026 at 10:50 pm

    Each Java process runs in a separate JVM. Each JVM has its own heap, separate from the heaps of other JVMs.

    The statistics that you’re looking at are for that process only. Similarly, System.gc() only works with the heap of the process that invoked it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a Java wrapper for accessing Sqlite but I assume this is a
I am using GWT for my client side application. I am not using GWT/Java
I have no particular Java knowledge whatsoever. We are running an opensource application which
On an IBM iSeries system, I have a Java program running - an application
When deploying a Java application, can I assume that every computer has java, and
Let us assume a Java application, accepting an integer command line argument, say bubu
Assume an application that has some locale-based raw resources. But the resources are not
Assume two Java String objects: String str = <my string>; String strLower = str.toLowerCase();
Is it safe to assume that java.util.concurrent.CompletionService.take().isDone() will always return true? If so, why
Let's assume I have a framework written in Java and some C++ code which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.