Garbage collection and closure

I am running a remote script from bridge that opens a complex dialog in photoshop. I need to run the dialog in photoshop because it displays fonts, styles and actions, which are not available in bridge.
When I close the dialog I return to my bridge script. If I repeated open the remote script with the complex dialog I continue to use up resources and the dialog opens more slowly each time.
If I run the remote script directly from the ESTK I still lose reources and it slows down, but not as significantly as when run as a remote script via bridgetalk.
I think this is caused by inner functions in my dialog, which are creating closures, which in turn are preventing garbage collection.
Has anyone experienced this and do you have any tips to prevent the performance degradation?

Rory,
I've never seen that before. In PS, the script that displays the dialog executes, then the engine that ran it supposed to be destroyed. Should be no need for garbage collection. Running the script directly in ESTK still uses BridgeTalk, so I would expect little difference.
I'd be curious to know what's happening because each time you run the script, it should be using a fresh scripting engine in PS. Perhaps there's something preventing PS from releasing the engine when BridgeTalk is involved. It that's the case, it would be a bug.
I do have a suggestion - instead of switching to PS, why not ask PS to give you lists of fonts, styles, and actions? You could write a script that put all three into a an array:
// up here create the arrays
var a = new Array();
a[0] = fontArray;
a[1] = styleArray;
a[2] = actionArray;
a.toSource();
eval'ing the message body in the onResult handler would give you all the info you needed to show your dialog in Bridge. Both Bridge and PS use scriptUI, so the dialog you have written should work in either (once you get the information necessary to display it in Bridge).

Similar Messages

  • Garbage Collecting and freeing memory in JTree

    Suppose you have a JTree with a model that takes a lot of memory. after you are finished using the tree you want to free this memory. so you go on and use the
    tree.setModel(null) method, hoping everything will be fine. to be extra sure you even set the root to null.
    what happens is that the tree view is cleared but the memory isn't.
    my conclusion is that somwhere in the tree package there are refrences to the tree root, model or whatever that keeps it from been garbage collected. to make sure my code doesn't keep any refrences to the tree model I am using a very thin class that only instantiates a tree and fills it with data. this class keeps no members, listeners, refrences and so on.
    calling system.gc() does nothing.
    Is there a simple way to clear memory in a JTree ?
    without using weak refrences and other unwanted complexities.

    Hi, thanks for the response.The C API version is 6.5.3 or 6.5.4.2, depending on the environment.I'll paste the code in here, but it is completely based on the sample programs so I'm not sure where else we could free up memory (any insights appreciated!):ESS_MEMBERINFO_T *pChildMemberInfo = NULL;sts = ESS_Init();if(sts == ESS_STS_NOERR){ sts = ESS_Login(srvrName, adminUserName, password);if(sts == ESS_STS_NOERR){// set the active dbsts = EssSetActive(hCtx, appName, dbName, &Access);if(sts == ESS_STS_NOERR){memset(&Object, '\0', sizeof(Object));// open the outline for use in subsequent callsObject.hCtx = hCtx;Object.ObjType = ESS_OBJTYPE_OUTLINE;Object.AppName = appName;Object.DbName = dbName;Object.FileName = dbName;sts = EssOtlOpenOutline(hCtx, &Object, ESS_FALSE, ESS_FALSE, &hOutline);if(sts == ESS_STS_NOERR){// get member names from outline, so// this section includes a number of // sts = EssGetMemberInfo(hCtx, // category, &pChildMemberInfo);// calls to query member names.// Then some calls are made to free // these resources:if(pChildMbrInfo){EssOtlFreeStructure(hOutline, 1, ESS_DT_STRUCT_MBRINFO, pChildMbrInfo);}if(pChildMemberInfo){EssFree(hInst, pChildMemberInfo);}EssOtlCloseOutline(hOutline);}}ESS_Logout();}ESS_Term();}

  • Garbage Collection and Constant CPU Usage

    Hello,
    We have a load balanced environment running ColdFusion 10 Enterprise with 5 instances currently running. Currently we only have one instance being actively used but have been encountering a problem within a time frame of 12 to 36 hours (calculated on the times we have had to restart CF to come back online) the garbage collection is running almost constantly and CPU holds at 50% until the server just becomes unresponsive until the CF instance is restarted.
    I have been monitoring the server via VisualVM to watch the CPU and Heap usage since I have found that running the server monitoring systems build into CF 10 Enterprise accelerate the problem to cause a crash within 4 to 5 hours.
    This issue has been occuring regardless if there is heavy load or not on the server. I have been seeing some odd behaviour when running CF Stat where I am seeing 4 Requests Queued and Running Requests never shows anything other than 0. I increased the Minimum Heap Size to 512 MB and Maximum Heap Size to 1024 MB and below is our JVM arguments
    -server -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch -Dcoldfusion.home={application.home} -Dcoldfusion.rootDir={application.home} -Dcoldfusion.libPath={application.home}/lib -Dorg.apache.coyote.USE_CUSTOM_STATUS_MSG_IN_HEADER=true -Dcoldfusion.jsafe.defaultalgo=FIPS186Random -Dcom.sun.management.jmxremote.port=8701 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
    We are running on a Windows 2008 64 Bit and IIS 7.5 on both of the load balanced servers and have updated the server to ColdFusion 10 Update 2. I am aware of the issues that are being fixed in Update 3 that was removed last week by Adobe due to bugs introduced.
    If anyone has any insight in how to fix this issue, I would be greatly appreciative.  This is affecting a production server that did not show these problems when we put the servers under load when we did pre launch settings.

    Further from your images - while it shows CF CPU at 50% the GC activity is 0%.
    So could be your not garbage collecting more than necessary and something else CF wise is taking CPU time.
    What would be interesting is the Jconsole Memory tab Details section. It shows the time spent in minor and major GC's.  eg:
    HTH, Carl.

  • How often is garbage collected and can I control it.

    The code I write tends to have a lots of graphics, video, audio all that stuff that uses lots of memory so I need to tidy up after myself. Are there any commands that force immediate collection? Any recommendations appriciated.

    So I would need CS4 to explicitly control?  I found a interesting link about garbage http://gskinner.com/talks/resource-management/    I also read that gc happens very differently in IE than FF which seems odd as they both use the same vm.

  • Reconciling garbage collection, heap overview, and object stats

    First, both the JRockit RuntimeAnalyzer and Console are great tools. We use
    them extensively so thank you.
    I'm trying to reconcile the numbers in these three tabs.
    1. How do I reconcile the Runtime Analyzer and Console output?
    - The Heap overview tab in our application profile shows Heap Overview as
    83% free.
    - However, the Garbage Collection tab of the profile and Console shows the
    application as oscillating between 50 Meg and 200 Meg of heap used. That's
    25% (50Meg/200Meg) to 100%(200Meg/200Meg) used. How do I interpret the 83%
    vs. the 100%?
    I don't believe the 83% free, but I'm skeptical that we consume 150Meg of
    memory in 50 seconds.
    2. How do I reconcile the Object stats with the Garbage collection?
    - Take the top heap user at end of recording, character buffer. It's 22.8%
    of heap using 6,328 KB. If the heap is actually only 34Meg ( 17% of 200Meg.
    I get the 17% from the 83% free), then 22.8% makes sense.
    - So what's in the 200Meg of heap?
    I sent this recording to the JRA team if you want to look at it.
    Thanks
    Jeff

    I've never heard it put that way. Very interesting.
    "Johan Walles" <johan@spamalamadingdong> wrote in message
    news:41bf0be3@mail...
    Note that the time it takes for the garbage collector to do its thing
    grows with the amount of live data.
    What the garbage collector really does is more like retaining the live
    data than disposing of the garbage.
    Regards //Johan
    Jeff wrote:
    Staffan,
    Thanks - you clearly answered my questions. Now the follow-on questions:
    1. Is there a way to get insight into what the 'dead' data is composed
    of?
    2. Is this pattern of consuming 3x the live data in about a minute
    'typical' or a disaster in the making?
    I'm trying to get a sense of what a reasonable target of 'dead' data is.
    The system processes about a meg of data per second, including database
    writes.
    Thanks
    Jeff
    "sla" <[email protected]> wrote in message
    news:33533893.1102952170368.JavaMail.root@jserv5...
    Hi Jeff,
    I'll try to answer the questions.
    1) The Heap overview in the application profile is a snapshot of the heap
    at the end of a garbage collection. At this time only live data is still
    on the heap. So it looks like you have 17% of the heap filled with live
    data (and some overhead as seen in the Heap overview).
    In the garbage collection tab you can see the heap usage oscillating
    between 35-40MB and 200MB. The lower value is right after a garbage
    collection and the higher value is right before a garbage collection. The
    garbage collector clears out about 160MB of "dead" data from the heap.
    This is the amount of temporary objects that you created during the
    garbage collection cycles.
    2) The Object statistics are also taken right after a garbage collection.
    At this time there is 34M of live data on the heap and of these about 22%
    is taken up by character arrays (not unusual).
    At this time the rest of the 200MB heap is empty. It's been cleared of
    all temporary objects and is ready for allocation of new objects.
    I hope this answered your questions.
    Regards,
    /Staffan

  • 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.

  • Manual garbage collection

    Im running a huge combinatorial generation algorithm and i'm starting to run into memory allocation errors on larger problem instances. I am using the -Xmx256m run time option on the JVM to give it more memory but im generating huge masses off stuff here.
    The question I have is, if I know an object isnt going to be used again is it worth destroying it in memory yourself; i assume if you have some undesired object you can do something like this;
    myObject = null;
    and then call the garbage collector to free up the memory..firstly will this work, secondly what is there performance tradeoff for calling the garbage collector more often and lastly is the garbage collector allready efficient enough that doing things like this is probably not worth it.
    Regards,
    Dave

    Setting references to null MAY help get immediate relief, but its not guarunteed to help. Same with the System.gc() call.
    Doing both those thing will not enable the system to operate with less memory than before, as variables that are out of scope will be discovered during garbage collection, and garbage collection WILL run when the heap is fully utilized.
    Doing the above may make the GC pause lower at the expense of worse performance.
    Instead of doing the above, I'd recommand using the Incremental GC by specifying -Xincgc on the command line. This will run GC more often in the background, leading to shorter GC pauses, but about 10% performance hit in general.
    If OTOH you are running into OutOfMemoryErrors and don't think you should be, you probably have a memory leak. Most likely you are allocating objects and storing them somewhere then forgetting about them. For example, if you stick an object in a HashMap, and then forget about it, that object will not be GC'd, unless the HashMap can be GC'd.

  • Premature Garbage Collection of Remote Objects

    I have a problem with distributed garbage collection and RMI. In CSPoker we try to support RMI for client-server communication. The client looks up the server through the registry, calls the login method and receives back a Remote Object reference called ServerContext. The client can register Remote even listener Objects with the server.
    In both directions we occasionally see:
    java.rmi.NoSuchObjectException: no such object in table
    The behaviour is completely unpredictable. Some developers never see it, others see it all the time. Even on the same machine, sometimes it failes immediately
    and sometimes it fails after a while. One person running the Sun JRE 6 on Windows has this poblem most frequently.
    Can this be a bug or do we misinterpret something? The way we see it, as long as the client leases the Remote Object it shouldn't be GCed. All tests are run on localhost so no network partition can occur.
    The problem would probably be solved if we hold static references to all Remote Objects in the local JVM. This is not an option because we want the Objects to be GCed once the lease expires.
    Here are 2 debugging outputs of server runs with RMI logging enabled:
    http://cspoker.pastebin.com/f27a7d6fc
    As you can see, the lease requests are coming through but a NoSuchObjectException is thrown and the Object is finalized.
    http://cspoker.pastebin.com/f732797d2

    Thanks for the quick reply.
    For instance:
    11:56:02,427 DEBUG (org.cspoker.common.api.shared.context.ForwardingRemoteServerContext.java:72) [finalize] - Garbage collecting old context: org.cspoker.server.rmi.export.ExportingServerContext@15a8767
    07.11.2008 11:56:02 sun.rmi.server.UnicastServerRef logCall
    FEINER: RMI TCP Connection(2)-10.0.4.106: [10.0.4.106: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]
    07.11.2008 11:56:03 sun.rmi.transport.Transport serviceCall
    FEIN: RMI TCP Connection(2)-10.0.4.106: [10.0.4.106] exception:
    java.rmi.NoSuchObjectException: no such object in table
            at sun.rmi.transport.Transport.serviceCall(Transport.java:129)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
            at java.lang.Thread.run(Thread.java:595)The context Object is exported and returned to the client here :
    return (ExternalRemoteServerContext) UnicastRemoteObject.exportObject(context, 0);Then [the object|http://code.google.com/p/cspoker/source/browse/trunk/server/rmi/src/main/java/org/cspoker/server/rmi/export/ExportingServerContext.java?r=1023] that was just exported is GCed.
    11:56:02,427 DEBUG (org.cspoker.common.api.shared.context.ForwardingRemoteServerContext.java:72) [finalize] - Garbage collecting old context: org.cspoker.server.rmi.export.ExportingServerContext@15a8767Then a lease request comes in:
    FEINER: RMI TCP Connection(2)-10.0.4.106: [10.0.4.106: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]Then the client calls a method on the remote object and the NoSuchObjectException is thrown.
    The behaviour is non-deterministic in any case but yes, on the Linux JVM I'm not seeing the problem, somebody on Windows gets it all the time.

  • No garbage collection data/detailed memory use data in Wily?

    Hi All,
    We are running some portals on AIX (1.4.2 SR12). We have installed the wily agent on the portals and the enterprise manager on our solman server. When looking in the introscope workstation the heap usage of the JVMs are shown as it should. However, the J2EE GC Overview 1/2 & 2/2 don't show any detailed data regarding garbage collection and memory usage (e.g. tenured; eden; etc...). At this moment we use IBM PMAT for memory analysis, but this is not real time. We would like to see memory details real time using Wily.
    Does anyone else also encounters this problem?
    Any suggestions?
    Thanks,
    Bart.

    Hello Amit
    Can you please open new thread for your question ?
    People won't check this thread to answer your question because the thread is marked "answered".
    Kind regards
    Tom

  • How to make external SWFs garbage collected in Air for iOS?

    My app uses lots of external SWFs( well they are actually included in the app with a folder but they aren't embeded ) and they do not contain any bitmapdata, only vector graphics. The problem I'm having is that they seem to be never garbage collected and System.privateMemory keeps increasing as the app loads more SWFs.
    Since those SWFs only contain vector graphics, I simply nullify all the variables that are holding reference to SWF file and call System.gc().. But it doesn't seem to be working. What would I need to do for the garbage collector to clean the SWFs?
    I'm using Air for iOS 3.5.0.1060 and ActionScript3.0.

    Yes I'm calling System.gc() twice. I tried using loader.unloadAndStop(true) and it seems SWFs are being garbage collected but another problem has surfaced. When repeatedly loading and unloading SWF in a short period, the air garbage collector sometimes fails to work.
    I've tested loading and unloading same SWF 50k times and checked trace.  Occasionally, garbage collector misses to collect garbage like below( swf #45119 is not being garbage collected).
    [UnloadSWF] main.swf/[[DYNAMIC]]/45115
    [UnloadSWF] main.swf/[[DYNAMIC]]/45116
    [UnloadSWF] main.swf/[[DYNAMIC]]/45117
    [UnloadSWF] main.swf/[[DYNAMIC]]/45118
    [UnloadSWF] main.swf/[[DYNAMIC]]/45120
    [UnloadSWF] main.swf/[[DYNAMIC]]/45121

  • Long pauses during ParNew garbage collection Please Help !

    Hi,
    We are running a server application on an large machine (~120 CPU, ~380 GB Memory).
    After running 1 or 2 hours we suddenly get exorbitant application pause times during garbage collection and a massive cpu usage from the java vm
    We are running on Java 6 (64Bit) with 6GB Heap.
    Concurrent garbage collection is turned on using the parameters:
    -XX:+UseConcMarkSweepGC
    -XX:+CMSParallelRemarkEnabled
    -XX:CMSInitiatingOccupancyFraction=80
    -XX:+DisableExplicitGC
    We turned on verbose garbage collection and are getting the following output:
    1. Normal operation:
    Application time: 217.4656792 seconds
    3180.905: [GC 3180.906: [ParNew
    Desired survivor size 20119552 bytes, new threshold 4 (max 4)
    - age   1:    2843824 bytes,    2843824 total
    - age   2:    2577128 bytes,    5420952 total
    - age   3:    5742024 bytes,   11162976 total
    - age   4:     625672 bytes,   11788648 total
    : 329531K->15764K(353920K), 0.1484379 secs] 2435799K->2122105K(3392144K), 0.1492386 secs]
    Total time for which application threads were stopped: 0.1886810 seconds
    2. The Problem:
    Application time: 2.8858445 seconds
    5008.433: [GC 5008.434: [ParNew
    Desired survivor size 20119552 bytes, new threshold 2 (max 4)
    - age   1:   15837712 bytes,   15837712 total
    - age   2:   12284416 bytes,   28122128 total
    : 348338K->39296K(353920K), 138.5317715 secs] 2487779K->2192551K(3392144K), 138.5327383 secs]
    Total time for which application threads were stopped: 138.5778558 seconds
    Application time: 2.9764564 seconds
    5149.957: [GC 5149.957: [ParNew
    Desired survivor size 20119552 bytes, new threshold 2 (max 4)
    - age   1:    9483176 bytes,    9483176 total
    - age   2:   14499344 bytes,   23982520 total
    : 353920K->39296K(353920K), 231.5110574 secs] 2507175K->2204546K(3392144K), 231.5121011 secs]
    Total time for which application threads were stopped: 231.5257754 seconds
    Application time: 2.7932907 seconds
    5384.277: [GC 5384.278: [ParNew
    Desired survivor size 20119552 bytes, new threshold 4 (max 4)
    - age   1:   10756376 bytes,   10756376 total
    - age   2:    9135888 bytes,   19892264 total
    : 353920K->28449K(353920K), 256.2065591 secs] 2519170K->2207651K(3392144K), 256.2076388 secs]
    Total time for which application threads were stopped: 256.2221463 seconds
    I can't find any significant differences in the log between fast and long running garbage collections.
    I urgently need help in solving this problem !
    What can I do ?

    After the exciting reply I did get on my question, we did some more investigations on the problem and it seems that we finally found the solution to our problem.
    The number of garbage collection threads used by the virtual machine defaults to the number of cpus of the machine.
    This is ok for small machines or machines where the main load is produced by the java application itself.
    In our environment the main load is not produced by the java application but oracle database processes.
    When java tries to do it's garbage collection using 120 threads (# CPU) on the machine which is already overloaded by non java processes, the thread synchronization seems to produce an exorbitant overhead.
    My theory is that spin locking is used on memory access, causing threads to spin while waiting for other blocking threads not getting cpu because of the heavy load on the system.
    The solution is now to limit the number of garbage collection threads.
    We did that on the first try by setting -XX:ParallelGCThreads=8
    For over one day with heavy load no long GC pauses were experienced any more.

  • Animation gets slow when program needs a Garbage Collect.

    So nonetheless, I should probably develop a new animation algorithm, yes?
    I am looping through a seperate thread that calls the setSize() methods a bunch of times. Works really nice when memory isnt bad, but when I need to garbage collect, and apparantly java doesnt agree, it gets really slow. Later one is really able to see when a GC is actually done, and it goes back to normal.
    Here is my algorithm,
    public static boolean raisePanel(final VCMSComponentFrame p, final boolean anim)
            if (p.getState() == VCMSComponentFrame.State.RAISED ||
                p.getState() == VCMSComponentFrame.State.ANIMATING)
                return false;
            new Thread(new Runnable()
                public void run()
                    p.setState(VCMSComponentFrame.State.ANIMATING);
                    if (anim)
                        for (int i = p.getHeight(); i <= FULL_PANEL_HEIGHT; i++)
                            try
                                p.setSize(p.getWidth(), i);
                                JComponent parent = (JComponent)p.getParent();
                                int index = findIndex(p);
                                for (int j = index + 1; j < parent.getComponentCount() && j != 0; j++)
                                     parent.getComponent(j).setLocation(parent.getComponent(j).getX(), parent.getComponent(j).getY() + 1);
                                //Viewport Panel
                                parent.setSize(parent.getWidth(), parent.getHeight() + 1);
                                //Structure Frame
                                VCMSStructurePanel panel = (VCMSStructurePanel)parent.getParent();
                                parent.getParent().setSize(panel.getWidth(), panel.getHeight() + 1);
                                //Structure Siblings.
                                JPanel master = (JPanel)panel.getParent();
                                index = findStructureIndex(panel);
                                for (int j = index + 1; j < master.getComponentCount() && j != 0; j++)
                                    master.getComponent(j).setLocation(master.getComponent(j).getX(), master.getComponent(j).getY() + 1);
                                Thread.sleep(1);
                            catch (Exception ex)
                    else
                        p.setSize(p.getWidth(), FULL_PANEL_HEIGHT);
                        JPanel parent = (JPanel)p.getParent();
                        int index = findIndex(p);
                        //Viewport Panel
                        parent.setSize(parent.getWidth(), parent.getHeight() + FULL_PANEL_HEIGHT - SHORT_PANEL_HEIGHT);
                        //Structure Frame
                        VCMSStructurePanel panel = (VCMSStructurePanel)parent.getParent();
                        parent.getParent().setSize(panel.getWidth(), panel.getHeight() + FULL_PANEL_HEIGHT - SHORT_PANEL_HEIGHT);
                        //Component Siblings
                        for (int j = index + 1; j < parent.getComponentCount() && j != 0; j++)
                            parent.getComponent(j).setLocation((int)parent.getComponents()[j].getLocation().getX(), (int)parent.getComponents()[j].getLocation().getY() + FULL_PANEL_HEIGHT - SHORT_PANEL_HEIGHT);
                        //Structure Grandparent
                        JPanel master = (JPanel)panel.getParent();
                        index = findStructureIndex(panel);
                        for (int j = index + 1; j < master.getComponentCount() && j != 0; j++)
                            master.getComponent(j).setLocation((int)master.getComponent(j).getLocation().getX(), (int)master.getComponent(j).getLocation().getY() + FULL_PANEL_HEIGHT - SHORT_PANEL_HEIGHT);
                    p.setState(VCMSComponentFrame.State.RAISED);
            }).start();
            //System.gc();
            return true;
        }any help appreciated!

    sierratech wrote:
    Only a guess, but this may have something to do with Threads and Swing.
    http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html.
    Many Swing updates should be called in the Event Dispatch thread, and it looks like you may be calling some of these in your new Thread.
    Try using SwingUtilities.invokeLater() and see if that helps. Alternatively, rewrite your code to remove the Thread and do everything in the event Dispatch thread using javax.swing.Timer. Again, just a guessThanks for the Idea, but this option doesnt even show the animation.
    One Idea I got from a "Swing Hacks" directory works like this:
    Remove the components for animation.
    Create an image of the components.
    Overide the Paint method.
    Animate the images via paint method.
    Remove the images.
    Add back the components.
    But I look at that and my stomach cringes.
    Any other Ideas?

  • When will the demo object be eleigible for garbage collection?

    class Test {
         private Demo d;
         void start() {
         d = new Demo();
         this.takeDemo(d);
         void takeDemo(Demo demo) {
         demo = null;
         demo = new Demo();
         }

    Hey flounder, I am myself confused about garbage collection and assertions (yesterday)... Anyway because of ur interest in answering my query, I'll give one more try... But, if it's wrong, Please help me out.
    The Demo (not demo) object created at line 4 has one 'this' reference on the next line. And as soon as this reference is eleigible, I guess even Demo d will be eligible. Correct?

  • 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".

  • Garbage Collection settings

    Hi All
    I have the following snippet from GC logs:
    Can we determine settings of VM?
    Are these settings too high, I mean is large amount of memory thrown at it?
    Also based on pattern in used Tenured Generation ( Ex: 271844K) can I determine a memory leak.
    Is it good or bad to use these kind of settings.
    Please let me know.
    Bib
    Heap
    def new generation total 104832K, used 57076K [0x10010000, 0x171d0000, 0x171d0000)
    eden space 93184K, 51% used [0x10010000, 0x12f32e20, 0x15b10000)
    from space 11648K, 75% used [0x15b10000, 0x163aa270, 0x16670000)
    to space 11648K, 0% used [0x16670000, 0x16670000, 0x171d0000)
    tenured generation total 932096K, used 409688K [0x171d0000, 0x50010000, 0x50010000)
    the space 932096K, 43% used [0x171d0000, 0x301e6148, 0x301e6200, 0x50010000)
    compacting perm gen total 131072K, used 75403K [0x50010000, 0x58010000, 0x58010000)
    the space 131072K, 57% used [0x50010000, 0x549b2e10, 0x549b3000, 0x58010000)
    33256.362: [Tenured: 409688K->271844K(932096K), 1.8892192 secs] 466764K->271844K(1036928K), [Perm : 75403K->75403K(131072K)] Heap after GC invocations=121:
    Heap
    def new generation total 104832K, used 0K [0x10010000, 0x171d0000, 0x171d0000)
    eden space 93184K, 0% used [0x10010000, 0x10010000, 0x15b10000)
    from space 11648K, 0% used [0x15b10000, 0x15b10000, 0x16670000)
    to space 11648K, 0% used [0x16670000, 0x16670000, 0x171d0000)
    tenured generation total 932096K, used 271844K [0x171d0000, 0x50010000, 0x50010000)
    the space 932096K, 29% used [0x171d0000, 0x27b49228, 0x27b49400, 0x50010000)
    compacting perm gen total 131072K, used 75403K [0x50010000, 0x58010000, 0x58010000)
    the space 131072K, 57% used [0x50010000, 0x549b2e10, 0x549b3000, 0x58010000)
    } , 1.8893669 secs]
    Total time for which application threads were stopped: 1.9019171 seconds

    Hi
    before the RBSMaintainer was run against a SharePoint content database (WSS_Content_XYZ)  for ORPHAN BLOB cleanup, from one of the web front end server and after they make  the database Read-only,  the RBS storage has nearly
    3.5 Million of BLOB files.
    The Original_Wss_Content_XYZ  database restored from   backup of WSS_Content_XYZ  database,
    if we restore every time  the same database I found that BLOBS are deleting from RBS storage.
    I  open ticket and ask Microsoft support they saying its by a filestream garbage collection and in background its deleting orphan blobs ,
    Is it  the case still this  background process not deleted the all Orphan BLOBS from this database and its why showing
    orphan_cleanup_in_progress = true; and is any way to stop the background process .
    for this database is there any way to check
    how many Orphans BLOBS actually exists in  and while it is running or after  how we can check the history for deleted BLOBS in  database
    adil

Maybe you are looking for