Ask Experts Questions for FREE Help !
Ask
    Suttaa's Avatar
    Suttaa Posts: 3, Reputation: 1
    -
     
    #1

    Mar 22, 2003, 01:03 PM
    Java programming
    Read the following statements and explain why it is either true or false
    1. The garbage collection mechanism is platform dependent
    2.you can suggest when garbage collection will run but you cannot be certain when it will take place.
    3.a reference to a primitative variable is eligble for garbage collection when it is set to null.
    4.the automtic garbage collection of java virtual machine prevents programs from ever running out of memory
    YDG's Avatar
    YDG Posts: 4, Reputation: 1
    New Member
     
    #2

    Mar 22, 2003, 10:18 PM
    java programming
    1. The garbage collection mechanism is platform dependent

    I don't really know, but Java is supposed to run the same, regardless of the operating system (it's one of the benefits of using Java). Possibly it could depend on the JVM beung used, but I'd be surprised if this was the case.

    2.you can suggest when garbage collection will run but you cannot be certain when it will take place.

    Well, garbage collection is done by a daemon thread, and like all threads, you can specify when something should run, but that doesn't necessarily mean that it will run when you say ;) I'm not sure you can actually invoke the garbage collection thread to run at a certain time (it's a background process that runs whenever higher priority threads stop/pause), but assuming you can invoke it, it'll be subject to all the quirks that normal threads are :D

    3.a reference to a primitative variable is eligble for garbage collection when it is set to null.

    Not sure. As far as I know, a variable is eligible for garbage collection if it is never referred to in the program again- I could probably think of a few times when testing to see if a primitive is null is actually a useful thing to do (such as I/O streams), which obviously wouldn't work if the garbage collector had come along and killed it ;)

    4.the automtic garbage collection of java virtual machine prevents programs from ever running out of memory

    Again, I don't really know ;) That may be it's intention, but stick a few infinte loops in your program and I'd be willing to bet things would lock up ;D

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

C programming [ 2 Answers ]

I'll be extremely thankful if u could provide me with a c program that convert a given nfa to dfa

Java/Windows Programming [ 1 Answers ]

Hi I'm trying to see whether it is possible to interact with windows through java. I have a RMI program that is installed on several computers in a network. I want to see when a user is in the idle stage i.e. no key pressing & no mosue moving etc.. If the program is running, I think the program can...

C programming [ 2 Answers ]

I need some help from you regarding a particular problem. I am using libnet raw packet library (libnet_build_ethernet) for transferring data over the network. For this, I have to first convert all the data to u_char type and then serialize them to contiguous memory locations. Can...

Java programming [ 1 Answers ]

Hi, I am running a java program. I want to see the Heap memory used for that program. How to see it?

Java programming [ 1 Answers ]

Read the following statements and explain why it is either true or false 1. The garbage collection mechanism is platform dependent 2.you can suggest when garbage collection will run but you cannot be certain when it will take place. 3.a reference to a primitative variable is eligble for...


View more questions Search