Can I force full garbage collection?

Hi, my program is memory bound , as users load more files more memory is required , if the user decides to load a very large number of files they will eventually run out of memory. So I am trying to detect when there is less 15% of heap memory left, then force garbage collection and if it cant free up more than 15% of the heap I will stop the user from loading any more files. But the problem is though I call System.gc() to try and force a full garbage collect it rarely
retrieve enough memory to get below the 15% limit. But using the Yourkit Profiler I can select the Force GarbageCollection option and this always manages to free up more memory to get the figure under the 15% limit. in support of this I found that sometimes my program stop me loading more files when there is still quite a bit available.
So my questions are.
1. I know System.gc() is only hint to garbage collect, but the docs imply it only replys after the garbage collection (if any) has been done, is this right or do I have to wait.
2. Is there any way to Force complete Garbage Collectionas profiler appears to do.
3. is there a VM option I could set instead to force the JVM to completely garbage collect at say 83% so that if I then polled that 85% of heap was being used I would know that it really was, and I wouldnt need to bother trying to garbage collect further. (Im using Suns 1.6. JVM on Windows and Linux, and Apples 1.5 or 1.6 JVM on Macs)
public static void checkMemoryWhilstLoadingFiles() throws LowMemoryException
        MemoryUsage mu = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
        //No max defined future proofing
        if(mu.getMax()==-1)
            return;
        if (mu.getUsed() > (mu.getMax()  *  0.85f))
            MainWindow.logger.warning("Memory low:" + mu);
            System.gc();
            MainWindow.logger.warning("Memory low gc1:" + ManagementFactory.getMemoryMXBean().getHeapMemoryUsage());
            System.gc();
            MainWindow.logger.warning("Memory low gc2:" + ManagementFactory.getMemoryMXBean().getHeapMemoryUsage());
            System.gc();
            MainWindow.logger.warning("Memory low gc3:" + ManagementFactory.getMemoryMXBean().getHeapMemoryUsage());
            mu = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
            if (mu.getUsed()  > (mu.getMax()  *  0.85f))
                MainWindow.logger.severe("Memory too low:" + mu);
                throw new LowMemoryException("Running out of memory:"+mu.getUsed());
            else
                 MainWindow.logger.warning("Memory usage reduced to:" + mu);   
    }thanks for any help Paul
Edited by: paultaylor on 27-Jun-2008 11:10

On all of the current Sun HotSpot JVM's, calling System.gc() will cause a full compacting collection. Unless you have -XX:+DisableExplicitGC on your command line, in which case the call is a noop. Or if you are running the mostly-concurrent collector (-XX:+UseConcMarkSweepGC) and have the -XX:+ExplicitGCInvokesConcurrent flag on your command line, in which case calling System.gc() will start a concurrent collection (and the calling thread will block until the cycle is finished).
But calling System.gc() isn't enough to recover all the space that might be recovered. For example, System.gc() will identify objects that are unreferenced but need to have their finalize() methods called before their space becomes available again. So one call to System.gc() won't recover their space. Those finalize() methods need some cycles to run in, so back-to-back (or back-to-back-to-back :-) calls to System.gc() won't help. If you use a lot of finalize() methods, you should leave a lot of time for the finalize() methods to run between the calls to System.gc(). (Better would be to convert your code to use WeakReferences and run your own reference processing queues, and then you could tell when you were done processing references. But that's real work.) Some people try calling System.runFinalization() and wait for that to return, but that has at least two failure modes (details left to the reader).
In addition, there are details like: if there is still 15% of the heap free, then we won't aggressively clear SoftReferences when you call System.gc(). We might if you waited until the heap was full and we collected it on our own, since we know how much free space there will be after a collection at the point where we are choosing which SoftReferences to clear, and use that to decide how aggressively to clear SoftReferences.
There is no method to force the collector to do a compacting collection at, say 85% full. There is an option to have the mostly-concurrent collector start a collection cycle that way. But there's no way to find out if a collection cycle is running.
You are skating on the edge of the qualities of service offered by the different collectors in the various JVM's available. That weakens your ability to "write once, run anywhere".

Similar Messages

  • Full Garbage Collection Problem

    Hi All,
    We are working on NetWeaver Application Server JAVA 7.0
    I am getting an error message in of the the EWA reports for JAVA system. The red alert says as below:
    The maximum ratio of full garbage collections to total garbage collections in the reported interval was higher than 90%.
    In order to solve the above problem, I increased Heap Memory for all JAVA Server nodes to 3072 (earlier it was 2048 for all the server nodes). However, still I am getting same error in EWA report.
    Can any one help me in further analysing and solving the above problem?
    Your help is appreciated.

    Here are links to some of the tools. I have worked with [IBM GC for IBM JVM|http://www.ibm.com/developerworks/java/library/j-ibmtools2/index.html]. You may have to try others that can read Sun JVM's GC log.
    http://www.tagtraum.com/gcviewer.html
    http://www.yourkit.com/overview/index.jsp
    https://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=HPJMETER
    http://java.sun.com/performance/jvmstat/visualgc.html

  • Full garbage collection issue, not releasing/flagging memory

    I have the following problem running on a multi-cpu windows server with Java 1.4.2_05 using WebLogic 8.1:
    During a lifecyle of the web application (under load, but not to heavy) memory usage seems ok and garbage collection is called regularly. Suddenly, the used heap starts to rize very fast and after a while, even a full garbage collection cylce, does not release any memory anymore.
    I am sure that, from our coding, we release memory ok, and normally we should only use about 5 to 10 mb for each user max (with0 normal defnew garbage collections).
    I tried changing the garbage collection parameters, but this does not solve the problem. Best scenario was with the concurrent collector and I got this output at +/- the end:
    [GC 100202K->93511K(115628K), 0.0091472 secs]
    [GC 148480K->139612K(163808K), 0.0225914 secs]
    [Full GC[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor289]
    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor290]
    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor273]
    153750K->133006K(164064K), 1.2434402 secs]
    [GC 148939K->137948K(203264K), 0.0223085 secs]
    [GC 188789K->177116K(203264K), 0.0180729 secs]
    [Full GC[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor312]
    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor322]
    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor309]
    189788K->170264K(203264K), 1.1851945 secs]
    [Full GC 203228K->203227K(203264K), 1.2876122 secs]
    [Full GC 203263K->203233K(203264K), 1.3354548 secs]
    [Full GC 203263K->203258K(203264K), 1.2873518 secs]
    <Jan 17, 2007 9:40:40 AM EST> <Error> <HTTP> <BEA-101017> <[ServletContext(id=33114655,name=console,context-path=/console)] Root cause of ServletException.
    java.lang.OutOfMemoryError
    >
    [Full GC 203263K->203233K(203264K), 1.2814516 secs]
    [Full GC 203233K->203231K(203264K), 1.6029044 secs]
    [Full GC 203263K->203242K(203264K), 1.3081352 secs]
    <Jan 17, 2007 9:41:51 AM EST> <Emergency> <WebLogicServer> <BEA-000210> <The WebLogic Server is no longer listening for connections.>
    [Full GC 203263K->203247K(203264K), 1.3161194 secs]
    [Full GC 203263K->203249K(203264K), 1.2954988 secs]
    [Full GC 203263K->203247K(203264K), 1.6423404 secs]
    <Jan 17, 2007 9:41:57 AM EST> <Alert> <WebLogicServer> <BEA-000218> <Server shutdown has been requested by <WLS Kernel>>
    [Full GC 203263K->203250K(203264K), 1.3161025 secs]
    Another strange item is: I maximized the amount of memory it uses to 512m with the Xmx parameter, I am almost sure that that one is used, but it never gets higher than 203M? Does anyone know why this is?
    Another strange item: the monitoring in the weblogic code indicates 32MB of usage (relative memory usage seems to be ok, but the quanity indication is just plain wrong) with 15 threads running.
    This problem does not exist when using JBoss 4.0.2 or 4.0.3 (standard j2ee settings).
    If anyone has an idea or can help me, I would appreciate it very very much. :)

    Hi ,
    Is this issue resolved ?
    we are facing same problem.
    1. We have checked the CPU and memory utilization everything is normal
    2. GC logs showing FULL GC calls continuously
    3. After restart the resin server system is working normally.
    Environment detail
    Resin ./resin-pro-3.0.18 on suse Linux
    Java JDK1.4.2_08
    Please suggest

  • How to specify when Full Garbage Collections occur in the Old Generation

    Hi. We seem to be having a problem with a number of JVMs (1.5.0_17-b04) that run a component of a Document Management application. This component stores a large amount of information in caches which reside in the Old Generation. Although these cache sizes can be somewhat controlled by the application, they are currently taking about 85% of the Old Generation space. Fortunately, very few objects get tenured into the Old Generation - they all are cleaned up in the New Generation space.
    The problem we are seeing is that with the Old Generation at 85% full, there are constant full GC's occurring. Since the caches cannot be removed, the system frantically tries to remove objects that can't be removed.
    We have three solutions in mind. The first is to increase the memory allocation to the Old Generation so that the caches take a smaller percentage of the available memory allocation. The second would be to decrease the size of the caches; but this is set more by the number of documents in the application and cannot be made much smaller.
    The third solution is to configure the JVM so that Garbage Collections in the Old Generation do not occur until the memory is more than a specific percentage of memory in the Old Generation. We would then set this percentage to be higher than the amount of memory being used by the caches.
    So, is it possible to tell the JVM to only run a Full GC when the memory in the Old Generation is greater than a specific value (say 85% full)?
    Thanks for your help.
    Andre Fischer.

    afischer wrote:
    The third solution is to configure the JVM so that Garbage Collections in the Old Generation do not occur until the memory is more than a specific percentage of memory in the Old Generation. We would then set this percentage to be higher than the amount of memory being used by the caches.
    So, is it possible to tell the JVM to only run a Full GC when the memory in the Old Generation is greater than a specific value (say 85% full)?Switch to the CMS collector.
    -XX:+UseConcMarkSweepGC
    -XX:CMSInitiatingOccupancyFraction=86

  • Reducing full Garbage Collection frequency.

    I've been trying to improve the performance while inserting a large number of records to an embedded H2 database. Monitoring memory useage suggests that it's being used rather innefficiently. A lot of the objects created by H2 seem to find their way into "tenured" space before being freed. Full mark-and-sweap garbage collections are occuring every couple of seconds, despite the fact that only about 10% of the available heap is occupied.
    Any advise on tuning the garbage collector to improve throughput in this case?

    I think if surviving objects max out the to-space (part of the young generation) the remaining objects are copied into the tenured generation.
    You can get more info via:
    -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+PrintGC -Xloggc:<filename>

  • Full Garbage Collection

    Hi Friends,
    I'm using weblogic workflow for my project. Last night i got one error, once i gone throw the bea ...i come to know that the error will comes because of "once the application calls webservice and the webservice intern calls the EJB stateless or stateful will fail". But my application is not using any sort of webservices. So i try to find the problem finally i found tht the problem is because of Garbage collection of Heap Size. It is taking 3.8508577 sec's. I feel in this time the JVM thread gets heighest priority and it is killing the application thread which is to be executed as usal.
    Can u guide me how to catch this exception so tht my application won;t get affected. The actual error says like this which is related to Garbage Collection...[Full GC 313152K -> 105060K (1004928K), 3.8508577 secs]. I'm using JDK 1.4.
    Thaks & Regards
    [email protected]

    Replies in this thread.

  • How can I prevent class garbage collection????

    Hi,
    Is there a way to prevent a class from being garbage collected without using the -noclassgc option? Is there some code I can include in a class that tells the JVM not to garbage collect that particular class?
    Thanks in advance,
    Jacob.

    The code shown below (slightly modified from yours) should work correctly on any 1.0.x throught 1.4 JVM.
    Look at this article for further info: http://www.javaworld.com/javaworld/javatips/jw-javatip52.html
    public class SQLManager extends PoolManager {
        private static SQLManager myself;
        //code.........................
        public static SQLManager getInstance() {
            // This version of a getInstance method suffers from the use of the
            // broken (unreliable) double checked locking idiom.  It should never
            // be used on a system with more than one processor and is ill-advised
            // any other time.  It can  lead to accesses to uninitialized objects.
            // See http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-double.html
            // or http://c2.com/cgi/wiki?DoubleCheckedLockingIsBroken
            // So despite its common appearance in books and pattern repositories,
            // it should not be used.
            if (myself == null) {
                synchronized(SQLManager.class) {
                    if (myself == null)
                        myself = new SQLManager();
            return myself;
        private SQLManager() {
            livethread();
            //code.........................
        void livethread()
            System.out.println("##############################################################");
            System.out.println("###################Live Thread called#########################");
            System.out.println("##############################################################");
            Thread thread = new Thread()
                public void run()
                    // added this code to ensure that run() actually is getting
                    // called
                    System.out.println("##############################################################");
                    System.out.println("#################### Thread Started ##########################");
                    System.out.println("##############################################################");
                    Class myClass = SQLManager.class;
                    while (true)
                        try
                            synchronized (myClass)
                                myClass.wait();
                        catch (InterruptedException ex)
                            System.out.println("##############################################################");
                            System.out.println("###################Thread interrupted#########################");
                            System.out.println("##############################################################");
                        finally
                            System.out.println("##############################################################");
                            System.out.println("################### Something Happened #########################");
                            System.out.println("##############################################################");
                    System.out.println("##############################################################");
                    System.out.println("#################### Thread Dead?? ##########################");
                    System.out.println("##############################################################");
            thread.setDaemon(true);
            System.out.println("##############################################################");
            System.out.println("#################### Starting Thread #########################");
            System.out.println("##############################################################");
            thread.start();
        //code.........................
    }

  • Can VI Logger full version collect slower than 10 Hz?

    I am using Logger Lite to collect data over prolonged periods (weeks to months) and would be happy with data collection rates of several seconds to several minutes between points.  Logger Lite will not allow collection slower than 10 hz.  The product sheet for Logger Full just says it supprts "low-speed and high-speed" logging.  What does this mean?  Does this mean that I can collect slower than 10 Hz?  Thanks...

    Hi!
    I have been looking into your issue, and I imagine I understand why you would want to do this.  You must be getting hundreds of results in a row that obtains the same value.  In looking into what these "low-speed and high-speed" logging rates would be, I have found that they again range between 10 Hz and 60 Hz.  Therefore, for your application it doesn't seem that VI logger is the right solution for you.  I would recommend looking into some of our other solutions.  For instance, if you were to use a version of LabVIEW, you would be able to create an application that could obtain values at most any rate you desired.  Also, SignalExpress is another method that should have much more control than VI Logger. 
    I hope this information has been helpful.  I would start by checking out the following product pages, and going from there.
    LabVIEW Comparison
    SignalExpress
    Regards,
    Jason W.
    National Instruments
    Applications Engineer

  • Simulate full garbage collection pauses

    Hi,
    I'm doing some performance tuning for our Java systems, and one thing I want to test is how the applications behave when "stop-the-world" Full GC pauses of various different durations occur in our JVMs. We have seen some problems in our systems where longer GC pauses have negative effects. However, it is difficult to recreate these conditions using the applications themselves. Does anyone know if it is possible to force a JVM to do a "stop-the-world" pause of a specified duration, that would simulate a GC?
    Notes -
    1) I'm not talking about forcing a GC - I know how to do this but this give no control on the duration of the GC. Appreciate might be able to work a solution by writing a program to use up X amount of memory followed by a forced GC, but hoping for something simpler!
    2) We have already exhaustively tuned our JVMs to reduces frequency and duration of Full GC as much as possible but they do still need to occur occassionally. Have engaged with forums alredy on how best to do this, so no need for more info on this!
    3) We are using multiple JVMs which communicate with each other (RMI, etc.), and a large part of what I'm testing is the effect on JVM A of a long GC pause in JVM B while A is communicating with B
    4) JVM version is 1.5.0_u18, normally running on Solaris 9/10
    Thanks in advance for any insights!
    Regards,
    Adrian

    Hi,
    The docs here:
    [http://docs.sun.com/app/docs/doc/806-1367/6jalj6mv1?a=view|http://docs.sun.com/app/docs/doc/806-1367/6jalj6mv1?a=view]
    seem to suggest something like what I want to do could have been achieved in Java 1.2, by sending SIGQUIT to the process. However, in Java 5, SIGQUIT just creates a thread dump. Anyone know if its possible to achive the behaviour from that link in Java 5 by any other means / signal?
    Regards,
    Adrian
    Edited by: AdrianFitz on 05-Mar-2010 13:40

  • Garbage Collection Pauses in a client application: Trashing.

    Hi,
    we have put in production a financial trading application written in Java. We are experimenting a strange behaviour of the garbage collector. We are experimenting GC pauses every 4-5 hours which raise CPU time to 100% for 30 seconds. These pauses are not-deterministic. Memory consumption of the entire application is very low (about 30MB).
    This is a strange beheaviour we have detected in the log file of GC:
    5020.027: [GC 27847K->14659K(63936K), 0.0086360 secs]
    5020.036: [Inc GC 14659K->24546K(63936K), 0.0149416 secs]
    5020.107: [GC 27842K->14658K(63936K), 0.0086947 secs]
    5020.116: [Inc GC 14658K->24546K(63936K), 0.0094716 secs]
    5020.181: [GC 27842K->14658K(63936K), 0.0086846 secs]
    5020.190: [Inc GC 14658K->24546K(63936K), 0.0095778 secs]
    5020.255: [GC 27842K->14658K(63936K), 0.0102155 secs]
    5020.266: [Inc GC 14658K->24546K(63936K), 0.0084659 secs]
    5020.335: [GC 27842K->14658K(63936K), 0.0088606 secs]
    5020.344: [Inc GC 14658K->24554K(63936K), 0.0084514 secs]
    as you can see in one second the GC and the IncGC are called many times. WHY?
    We have read articles and tried all various known settings. But we didn't find any solution and at the moment we don't know how to move.
    Thank you for your hint
    Piero

    Which settings have you tried? By the looks of things you've not set any of your JVM memory variables.
    Try bumping up your maximum heap space using -Xmx.
    If you are running on a nice server try using -Xmx256m -Xmx256m -Xmn64m, these should help for a start.
    Also why are you using the "incremental garbage collector" when you have such a tiny application as you can see a full garbage collection is only taking 0.01 seconds.
    Also try reading this http://java.sun.com/docs/hotspot/gc/

  • Howto Force Garbage Collection manually in Oracle Application Server

    Hi,
    I have a Oracle SOA suite installed on Oracle 10g Application Server. The heap memory for the SOA oc4j container is 2G with a permgen space of 256M. But it looks like there is some memory leak somewhere and the Heap area is getting filled frequently and this causes an *[libopmnoc4j] OC4J ping attempt timed out* and as a result of this the SOA oc4j container gets restarted automatically.
    Is there any means by which we can force a Garbage Collection manually so that this automatic restart does not happen.
    Kindly let me know if it is possible to trigger a Garbage Collection manually in Oracle Application Server.
    Thanks,
    Vijay.

    We had a similar situation where the oc4j instance will throw OutOfMemoryException and opmn will restart a new instance every 10-12 hours. The JDBC 10.2.0.3 driver has a memory leak in the XA Resource classes. There is a fix available in metalink.

  • EWA Alert A- high ratio of full garbage

    Hi All,
    I have been receiving "RED" EWA report for pure JAVA stack from past 3 weeks. Earlier also I had got it and then the heap memory size was 1024. I had increased to 3GB and then I started getting a "YELLO" EWA report alert. However, from past 3 weeks I have been getting a red EWA report for full Garbage Collection problem.
    I had gone throug some of the threads here and found some usefule info like, Paul mentioned in below link:
    [EWA Alert A- high ratio of garbage collection|EarlyWatch Alert A - high ratio of full garbage;
    How have gone to th dev_server0 file and saw some of the garbage collections there. I am quite unable to get the details mentioned there like:
    1.
    Mon Dec 12 07:43:12 2011
    796020.432: [GC 796020.432: [ParNew: 319604K->28169K(320128K),
    0.0588451 secs] 2671315K->2382219K(3116672K), 0.0589239 secs]
    2.
    Thu Dec 08 10:40:24 2011
    461123.817: [Full GC 461123.817: [Tenured
    Thu Dec 08 10:40:25 2011
    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor150]
    [Unloading class sun.reflect.GeneratedMethodAccessor543]
    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor220]......
    I think the first one is the small garbage collections and the latter one is the "Full GC" as the name itself says.---Correct me if I am wrong.
    Can any one help me in understanding the above details?
    What should I do to remove this from my EWA alert?
    Regards,
    Faisal

    Hi,
    I have gone through the server nodes , std_server<n>.out (I have 3 server nodes) and found that on today's date, there are Full GC written in the logs multiple times. But can any one help me in diagnosing this and reaching out to the cause of this problem?
    Regards
    Faisal

  • Garbage Collection Mysteries

    I have an application that consumes huge amounts of heap at time, on the order of 100 MB. I added some code to call System.gc() when I dispose of the window that is responsible for making such huge allocations. My understanding is that System.gc() is supposed to do a full garbage collection, but when I am watching the heap in the Eclipse profiler it does not seem to reclaim very much. In almost ever case, when I click the garbage collect button in the profiler it seems to do a much better job of collecting a lot.
    What is the difference between explicitly invoking the garbage collector from the Eclipse profiler and calling System.gc() in code when the window is disposed?
    How can I get my code to automatically make the garbage collector work so well?
    Cheers, Eric

    jschell wrote:
    Might note however that calling gc() is unlikely to do anything to make your application better.Ain't it the truth. In fact it may even make it worse. Sane applications should not need manual GC calls - the runtime does what it is supposed to do itself and if it doesn't you should investigate and fix the problem that is preventing it from doing what it is supposed to do. First making sure that there is in fact an issue of course, perhaps the app simply needs 100mb of heap space at some point in the lifetime of your application. It isn't exactly a HUGE amount of memory, especially in a Java or .NET VM environment.

  • Garbage collection Java Virtual Machine : Hewlett-Packard Hotspot release 1.3.1.01

    "Hi,
    I try and understand the mechanism of garbage collection of the Java Virtual Machine : Hewlett-Packard Hotspot release 1.3.1.01.
    There is description of this mechanism in the pdf file : "memory management and garbage collection" available at the paragraph "Java performance tuning tutorial" at the page :
    http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,1607,00.html
    Regarding my question :
    Below is an extract of the log file of garbage collections. This extract has 2 consecutive garbage collections.
    (each begins with "<GC:").
    <GC: 1 387875.630047 554 1258496 1 161087488 0 161087488 20119552 0 20119552
    334758064 238778016 335544320
    46294096 46294096 46399488 5.319209 >
    <GC: 5 387926.615209 555 1258496 1 161087488 0 161087488 0 0 20119552
    240036512 242217264 335544320
    46317184 46317184 46399488 5.206192 >
    There are 2 "full garbage collections", one of reason "1" and one of reason "5".
    For the first one "Old generation After " =238778016
    For the second "Old generation After " =238778016
    Thus, "Old generation Before garbage collection" of the second is higher than "Old generation After garbage collection". Why?
    I expected all objects to be allocated in the "Eden" space. And therefore I did not expect to s

    I agree but my current Hp support is not very good on JVM issues.
    Rob Woollen <[email protected]> wrote:
    You'd probably be better off asking this question to HP.
    -- Rob
    Martial wrote:
    The object of this mail is the Hewlett-Packard 1.3.1.01 Hotspot JavaVirtual Machine
    release and its garbage collection mechanism.
    I am interested in the "-Xverbosegc" option for garbage collectionmonitoring.
    I have been through the online document :
    http://www.hp.com/products1/unix/java/infolibrary/prog_guide/java1_3/hotspot.html#-Xverbosegc
    I would like to find out more about the garbage collection mechanismand need
    further information to understand the result of the log file generatedwith the
    "-Xverbosegc"
    For example here is an extract of a garbage collection log file generatedwith
    Hewlett-Packard Hotspot Java Virtual Machine. Release 1.3.1.01.
    These are 2 consecutive rows of the files :
    <GC: 5 385565.750251 543 48 1 161087488 0 161087488 0 0 20119552 264184480255179792
    335544320 46118384 46118384 46137344 5.514721 >
    <GC: 1 385876.530728 544 1258496 1 161087488 0 161087488 20119552 020119552 334969696
    255530640 335544320 46121664 46106304 46137344 6.768760 >
    We have 2 full garbage collections, one of Reason 5 and the next oneof Reason
    1.
    What happened between these 2 garbage collections as we got : "Oldgeneration
    After" of row 2 is higher than "Old generation Before" of row 1? Iexpected Objects
    to be initially allocated in eden and so we could not get "old generation2modified
    between the end of one garbage collection and before the next one.
    Could you please clarify this issue and/or give more information aboutgarbage
    collection mechanisms with the Hewlett-Packard Hotspot Java VirtualMachine. Release
    1.3.1.01.

  • [scjp exam] garbage collection questions

    can someone please post me some garbage collection questions + correct answers, because i've taken the SCJP test again and i didn't passed it again. A co-worker of mine also didn't passed either.
    (We both got 0% on Garbage Collection every time) And i really thought i had it correct the last time.
    So please can someone mail/post me some garbage collection questions? thanks!

    The garbage collector collects unreachable objects.
    You have no control over when the objects are
    collected, but there is a guarantee that all
    unreachable objects will be collected before an
    OutOfMemoryError is thorwn.Exactly my thoughts...
    That's it. It really is just that simple. I scored 94%
    on the Programmer's Exam, with 100% in the garbage
    collection section.Hmm i got 54% last exam i took. I really begin to doubt about myself, because i find the questions on the exam so tricky.. Last book was Exam Cram (Java), and i found this a very nice and good book to study for the exam. Garbage collection is just one question, so it's either 0% or 100%. So far it hasn't gone anything higher then 0% with me.
    Here are some questions:
    1. When is the Object first available for garbage
    collection (when does it become unreachable)?
    Object o = new Object();
    Object p = o;
    o = null;
    p = null;p = null; -> available for gc.
    2. When is the Object first available for garbage
    collection?
    Object o = new Object();
    Vector v = new Vector();
    v.add(o);
    o = null;
    v = null;v = null; -> available for gc.
    3. Can the Vectors be garbage collected at the end of
    this code?
    Vector v = new Vector();
    Vector w = new Vector();
    v.add(w);
    w.add(v);
    v = null;
    w = null;yes
    Now i have a question:
    public int foo {
    Integer result = new Integer(10);
    result = null;
    return result;
    when is result available for gc?

Maybe you are looking for

  • Add log button in alv report-OO

    Hi experts, i have a alv report with 2 buttons: one - RElease order and the other is LOG. the user want that after he push on release button(that operate a functions) he want to see if it ended succesfuly - so he need log. the problem is that i dont

  • Are there other widgets for iWeb (iLife 09)?

    Specifically, I could really use a weather lone, like the dashboard offering. I could also use a rotating photo gallery widget for starters. I'd also like a calendar one that offers something like the "Upcoming events" calendar on this page: http://w

  • Color Corrector's Frame Viewer Split Not Showing Up On External Monitor

    Kind've a long title - sorry - but . . . here's my question: Why am I not able to see the Frame Viewer's split on my external monitor? A further, more detailed explanation of the problem: I recently purchased Ripple Training's Color Correction with A

  • Help for Menu

    hi everyone, i am very new in java. i am having problem in SWITCH CASE STATEMENT. can anyone please help me to solve the following problem: you have to write a program in java to generate the following menu with submenus: about linked List 1: ADD ELE

  • Capture the Fulfilled order

    Hi All, I am having an order with order line status of Fulfilled and header status Booked, how can i capture this order. Thanks Vivek