Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2008
    Posts
    3
    Rep Power
    0

    Thumbs up Garbage collector and its impacts

    Hi everybody,
    I have a basic doubt regarding garbage collector. i am aware that garbage collector will sweep all the unreferenced references(pointing to null) when it runs. Also i have heard that nobody can predict when the garbage collector will run.. In my project i have so many unreferenced variables. What i think is, when the amount of unreferenced variables in my application increases to a huge size, garbage collector will start to run and sweep all the unreferenced variables. but because of this, will there by any slowness in the application? I perceive that when the garbage collector runs, all applications tends to slow down.. correct me if my perception is wrong!!

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Garbage collector is fully under control with JVM, so it decide when to run it. But within a program you can ask JVM to run the garbage collector too. But in that case there is no guarantee that JVM can do it.

    Basically JVM sense that on what time garbage collector should run, basically at the time JVM find running on low memory.

    Running of garbage collector not caused for system slowness. So you can call it any time.

    Best thing is, as much as possible, use less number of reference. And also remove them if you find they are no longer useless within your application.

Similar Threads

  1. 3d array filled with garbage values
    By jon80 in forum New To Java
    Replies: 5
    Last Post: 01-01-2009, 11:12 PM
  2. Interacting with the Java Garbage Collector
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-28-2008, 09:04 PM
  3. How to use the garbaje collector
    By Eric in forum Advanced Java
    Replies: 2
    Last Post: 06-29-2007, 02:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •