Garbage & Memory

Hello..
1. Is there a way for me to display the allocated memory
for my program in runtime ?
so, it will be like a memory information.
2. Is there a way for me to FORCE the GARBAGE COLLECTOR ro run?
Thank you.

To scsi-boy,
ok, but at the top of the page it does say "you can
force object finalization and garbage
collection using the appropriate method in the
System class"
sigh
i would ascribe this mainly to being poorly written. the page header
also refers to "Forcing Finalization and Garbage Collection" but the
Force part refers to the finalization. again it is more significant that
the word force when thery are only talking about garbage collection.
to sum up my point as succintly as possible.
if i wrote my own JVM which ignored each and every call of gc() then my
VM would still be ok with meeting the specification, therefore the
behaviour cannot be garaunteed under all circumstances. the answer i
draw from this is that you cannot force the collector to run as force to
me implies 100% reliability in the behaviour of the method.
in an effort to illustrate why this method is only a suggestion i would
like to draw a parallel example with another part of the Java API.
i refer you to the JDBC ResultSet method setFetchSize(int size). this
method allows the caller to hint at the number of rows that should be
fetched from the database at one time. this method is intended to help
applications tune performance, it is not intended to be used instead of
a WHERE clause or LIMIT statement. as such the method documentation
talks about how you are giving a hint to the driver, not an absolute
value that it must follow.
to parallel the gc() method is intended to give applications the ability
to tweak runtime performance. again this is based on the assumption that
you as the programmer may have a best-fit idea of when garbage
collection should be performed. it is not intended to be a command that
the VM must follow, thus the use of the word suggest.

Similar Messages

  • Logging Garbage collector for an OC4J with 2JVM

    Hi, I have one OC4J with two JVM setted.
    If I put -verbose:gc it logs in the std Output file.
    I trying to log the garbage collector in two different file each one for one JVM.
    Anyone as an idea?

    Don't create massive amounts garbage memory. It's that simple. You should try to limit the creation of memory inside your animation loop. If there is a process inside the loop that creates memory, there is definitely some way to create that item staticly, rather than allocating new memory with each iteration. There shouldn't be any kind of problem that would involve the creation of THIS much memory, and it's deallocation. If you read about how the garbage collector is implemented, you'll notice that it stores all of it's memory on a single conveyor belt. This is for ALL memory in the program. Therefor once the garbage collector has gone through and marked all of the memory that needs to be reclaimed, it performs it's sweep and must feeze the entire program because that conveyor belt can not be manipulated while it's re-arranging the memory. The garbage collector will eliminate MOST memory leaks, but it does not eliminate any thought on the part of the programmer about memory.
    -Jason Thomas.

  • Memory upgrade from 10600 to 12800

    Hi. At the moment i'm using 2 x 2 Gb memory modules with my elite book but want to upgrade to 2 x 4 Gb. I know my laptop supports (only) PC3-10600 / 1333MHz memory but i wonder if i can use faster PC3-12800 / 1600 MHz modules but only gain the lower supported rate, or does it have to be exactly PC3-10600 / 1333MHz modules? Can i change some values in BIOS so it recognises the faster memory modules but works with the supported speed or should i rather get "right" modules and forget about these faster ones?

    Get the right modules and forget about faster ones; BUT. The only advantage I can see is that more current hardware can actually be cheaper. If you get the opportunity to get DDR3-1600 SO-DIMMs at a really good price I would not pass it up as long as they are not generic garbage memory. But that is only to get the best price. The RAM will still run at 1333 mhz. Also look for low density modules: 8 black memory blocks per side and not 4. Also only run pairs of identical modules for best performance. 

  • Daily Kernel Panics....Are Apple hiding something?

    Guys,
    I am getting kernel Panics on almost a daily basis now and i have been following this thread http://discussions.apple.com/thread.jspa?threadID=459270&tstart=45
    But someone has locked it. Why? Do Apple not want us talking about these things?
    I am getting really annoyed at these panics, it can't be bad ram as i have had 2 other MBP's with the same RAM in and never got the panics.
    Can you help by looking at these logs?
    Tue May 2 16:50:42 2006
    panic(cpu 0 caller 0x0034FBE6): mbuf address out of range 0x2c4208
    Backtrace, Format - Frame : Return Address (4 potential args on stack)
    0x24d4bb04 : 0x128b5e (0x3bbeb8 0x24d4bb28 0x131bbc 0x0)
    0x24d4bb44 : 0x34fbe6 (0x3db914 0x2c4208 0x156ec68 0x13f5f5)
    0x24d4bb64 : 0x22e673 (0x1 0x2 0x24d4bb74 0x18)
    0x24d4bc44 : 0x22d460 (0x5a62540 0x34 0x1 0x201000a)
    0x24d4be14 : 0x222007 (0x36bba300 0x14 0x24d4bf14 0x965506)
    0x24d4be54 : 0x223a8b (0x36bba300 0x14 0x6 0x0)
    0x24d4bf64 : 0x211109 (0x36bba300 0x36bba300 0x42cb5c 0x135798)
    0x24d4bfa4 : 0x1f773d (0x3ac3404 0x36bba300 0x36b8901a 0x1)
    0x24d4bfd4 : 0x197a21 (0x0 0x0 0x358d318 0x134aec) Backtrace terminated-invalid frame pointer 0x0
    Kernel version:
    Darwin Kernel Version 8.6.1: Tue Mar 7 16:55:45 PST 2006; root:xnu-792.9.22.obj~1/RELEASE_I386
    Thu May 4 17:14:58 2006
    panic(cpu 0 caller 0x0034FBE6): mbuf address out of range 0x2c4208
    Backtrace, Format - Frame : Return Address (4 potential args on stack)
    0x24e13b04 : 0x128b5e (0x3bbeb8 0x24e13b28 0x131bbc 0x0)
    0x24e13b44 : 0x34fbe6 (0x3db914 0x2c4208 0x156ec68 0x36a6003c)
    0x24e13b64 : 0x22e673 (0x1 0x2 0x18 0x18)
    0x24e13c44 : 0x22d460 (0x3e9fe88 0x34 0x1 0x201000a)
    0x24e13e14 : 0x222007 (0x36be2b00 0x14 0x24e13f14 0x968506)
    0x24e13e54 : 0x223a8b (0x36be2b00 0x14 0x6 0x0)
    0x24e13f64 : 0x211109 (0x36be2b00 0x36be2b00 0x42cb5c 0x135798)
    0x24e13fa4 : 0x1f773d (0x3b61e04 0x36be2b00 0x36a6001a 0x1)
    0x24e13fd4 : 0x197a21 (0x0 0x0 0x358d318 0x3a80c000) Backtrace terminated-invalid frame pointer 0x0
    Kernel version:
    Darwin Kernel Version 8.6.1: Tue Mar 7 16:55:45 PST 2006; root:xnu-792.9.22.obj~1/RELEASE_I386
    Mon May 8 18:55:54 2006
    panic(cpu 1 caller 0x0034FBE6): mbuf address out of range 0x2c4208
    Backtrace, Format - Frame : Return Address (4 potential args on stack)
    0x2569bbd8 : 0x128b5e (0x3bbeb8 0x2569bbfc 0x131bbc 0x0)
    0x2569bc18 : 0x34fbe6 (0x3db914 0x2c4208 0x2569bc38 0x198b25)
    0x2569bc38 : 0x22e673 (0x1 0x2 0x5a8 0x46ad7f8)
    0x2569bd18 : 0x23126d (0x47a6858 0x0 0x3552bd 0x2569bebc)
    0x2569bd38 : 0x35561b (0x47a6630 0x0 0x2569bebc 0x13572c)
    0x2569bdf8 : 0x346cb5 (0x47a6630 0x0 0x2569bebc 0x0)
    0x2569be28 : 0x3427e0 (0x4804a50 0x2569bebc 0x47bf504 0x0)
    0x2569bf18 : 0x3429f9 (0x42941f4 0x4804a50 0x1b 0x15f7a075)
    0x2569bf78 : 0x36d8e4 (0x42941f4 0x476b004 0x476b048 0x0)
    0x2569bfd8 : 0x197e7e (0x4b38f90 0x4b38f90 0x359e9000 0x2569bd24) No mapping exists for frame pointer
    Backtrace terminated-invalid frame pointer 0xb0b1f2a8
    Kernel version:
    Darwin Kernel Version 8.6.1: Tue Mar 7 16:55:45 PST 2006; root:xnu-792.9.22.obj~1/RELEASE_I386
    Thu May 11 16:07:51 2006
    panic(cpu 0 caller 0x0034FBE6): mbuf address out of range 0x2c4208
    Backtrace, Format - Frame : Return Address (4 potential args on stack)
    0x24d43b04 : 0x128b5e (0x3bbeb8 0x24d43b28 0x131bbc 0x0)
    0x24d43b44 : 0x34fbe6 (0x3db914 0x2c4208 0x1544c68 0x13f5f5)
    0x24d43b64 : 0x22e673 (0x1 0x2 0x24d43b74 0x18)
    0x24d43c44 : 0x22d460 (0x42ff228 0x34 0x1 0x201000a)
    0x24d43e14 : 0x222007 (0x368c3200 0x14 0x24d43f14 0x949506)
    0x24d43e54 : 0x223a8b (0x368c3200 0x14 0x6 0x0)
    0x24d43f64 : 0x211109 (0x368c3200 0x368c3200 0x42cb5c 0x135798)
    0x24d43fa4 : 0x1f773d (0x3a8d804 0x368c3200 0x368e781a 0x1)
    0x24d43fd4 : 0x197a21 (0x0 0x0 0x3562278 0x34fe2000) Backtrace terminated-invalid frame pointer 0x0
    Kernel version:
    Darwin Kernel Version 8.6.1: Tue Mar 7 16:55:45 PST 2006; root:xnu-792.9.22.obj~1/RELEASE_I386

    Hmm. Well unless Mac OS X does things in a completely different way to other unix platforms I've used, it looks like its impossible to tell where the problem is from the stack trace as the kernel appears to have been built with the symbol table stripped out. That's why you're just getting addresses and not the names of functions. Not a very useful thing to do really. I can't tell for sure though as the file(1) command on OSX doesn't seem to report this (stripped/not stripped) either. Also not a very useful thing to do.
    I concur with others on this thread that if you've moved the same RAM between 3 systems now, that you might have statically damaged it on the 3rd attempt. You have been using anti-static straps haven't you ???
    What about putting the original memory back into the system and running it with that to see if the problem happens again?
    Having said that, there's also a chance this isn't memory. Something is trashing memory pointers, yes. But the panic string is suspiciously consistent. It could be either be a buggy device driver, or 3rd party kernel extensions, or some other hardware component on the system that's playing up and feeding the kernel a garbage memory address.
    If Apple's hardware tests (described elsewhere in this thread) can't find the problem, tracking this down would be a nightmare, as the memory address causing the panic could get corrupted much earlier and take some time to bubble to the surface. All depends on system usage. The only way to find a problem like that would be for Apple to first custom build you a kernel with the symbol table so they could examine the stack in more detail. And then build further custom instrumented kernels that back track and log where addresses are coming from. It could take several iterations of this process before they found the culprit. It's NOT an easy thing to do. And I don't know if they would even do such a thing unless you're a big corporate account as its very expensive in engineering time to do it. Would be cheaper for them to just give you a new one.
    My advice: Run the hardware tests and hope it turns up a bad memory dimm. If it doesn't find anything, return it and get a replacement. If you swap the system and afterwards re-use the same memory for a 4th time, and it does the same thing again, it's your memory that's the problem. Buy another memory dimm and try using it in combination with the other two to eliminate the problem.

  • What works?

    please everyone that attempts to run a K7N2 board check that the memory and power supply you use is one that will work with the board. Check first with the post signatures the system that are running fine and try to use what they use or you will be disapointed.
    time and time again people try garbage memory and power supplys...
    it's your system run it with what works...

    hi
    just thought i should add some words.
    i got my computer working with crappy memory and a crappy psu.
    only trouble i have had was when i tried to tight up the memory timings.did not boot.
    i have had an incredible luck with getting this to work as good as it does.
    i cant remember having any random reboots in around 6 months.
    the trouble people have is often memory or psu related.
    for example is mushkin a very good memory.
    only once have i heard about trouble with it.
    was a bad stick.
    just beacause a psu is rated 400w does not mean it can handle the load.
    an enermax 350w has MUCH more power than a q-tec 550w.
    if anyone has some questions just post them and we in here can answer them.
    bye

  • High Eden Java Memory Usage/Garbage Collection

    Hi,
    I am trying to make sure that my Coldfusion Server is optomised to the max and to find out what is normal limits.
    Basically it looks like at times my servers can run slow but it is possible that this is caused by a very old bloated code base.
    Jrun can sometimes have very high CPU usage so I purchased Fusion Reactor to see what is going on under the hood.
    Here are my current Java settings (running v6u24):
    java.args=-server -Xmx4096m -Xms4096m -XX:MaxPermSize=256m -XX:PermSize=256m -Dsun.rmi.dgc.client.gcInterval=600000 -Dsun.rmi.dgc.server.gcInterval=600000 -Dsun.io.useCanonCaches=false -XX:+UseParallelGC -Xbatch ........
    With regards Memory, the only memory that seems to be running a lot of Garbage Collection is the Eden Memory Space. It climbs to nearly 1.2GB in total just under every minute at which time it looks like GC kicks in and the usage drops to about 100MB.
    Survivor memory grows to about 80-100MB over the space of 10 minutes but drops to 0 after the scheduled full GC runs. Old Gen memory fluctuates between 225MB and 350MB with small steps (~50MB) up or down when full GC runs every 10 minutes.
    I had the heap set to 2GB initally in total giving about 600MB to the Eden Space. When I looked at the graphs from Fusion Reactor I could see that there was (minor) Garbage Collection about 2-3 times a minute when the memory usage maxed out the entire 600MB which seemed a high frequency to my untrained eye. I then upped the memory to 4GB in total (~1.2GB auto given to Eden space) to see the difference and saw that GC happened 1-2 times per minute.
    Is it normal in Coldfusion that the Eden memory would grow so quickly and have garbage collection run so often? i.e do these graphs look normal?
    Also should I somehow redistribute the memory available to give the Eden memory more since it seems to be where all the action is?
    Any other advice for performance improvements would be much appreciated.
    Note: These graphs are not from a period where jrun had high CPU.
    Here are the graphs:
    PS Eden Space Graph
    PS Survivor Space Graph
    PS Old Gen Graph
    PS Perm Gen Graph
    Heap Memory Graph
    Heap/Non Heap Memory Graph
    CPU Graph
    Request Average Execution Time Graph
    Request Activity Graph
    Code Cache Graph

    Hi,
    >Is it normal in Coldfusion that the Eden memory would grow so quickly and have garbage collection run so often?
    Yes normal to garbage collect Eden often. That is a minor garbage collection.
    >Also should I somehow redistribute the memory available to give the Eden memory more since it seems to be where all the action is?
    Sometimes it is good to set Eden (Eden and its two Survivor Spaces combined make up New or Young Generation part of JVM heap) to a smaller size. I know your thinking - what make it less, but I want to make it bigger. Give less a try (sometimes less = more, bigger not = better) and monitor the situation. I like to use -Xmn switch, some sources say to use other method/s. Perhaps you could try java.args=-server -Xmx4096m -Xms4096m -Xmn172m etc. I better mention make a backup copy of jvm.config before applying changes. Having said that now you know how you can set the size to bigger if you want.
    I think the JVM is perhaps making some poor decisions with sizing the heap. With Eden growing to 1Gb then being evacuated not many objects are surviving and therefore not being promoted to Old Generation. This ultimately means the object will need to be loaded again latter to Eden rather than being referenced in the Old generation part of the heap. Adds up to poor performance.
    >Any other advice for performance improvements would be much appreciated.
    You are using Parallel garbage collector. Perhaps you could enable that to run multi-threaded reducing the time duration of the garbage collections, jvm args ...-XX:+UseParallelGC -XX:ParallelGCThreads=N etc where N = CPU cores (eg quad core = 4).
    HTH, Carl.

  • Optimization of the JVM memory - Garbage Collector

    Hi ,
    Just a question about JVM memory management.
    There is memory limitation of memory usage limitation (1.6M) in JVM.
    Is there any possibility to use "Garbage collector" mechanism to optimize the memory usage?
    Or any suggestions for the JVM memory optimization?
    Thanks a lot!!!

    nicolasmichael wrote:
    Hi,
    the "memory limitation" does not have anything to do with garbage collection, but with the address space your operating system provides. On a 32bit operating system, your virtual address space is limited to <= 4 GB, depending on your operating system (for example 1.something GB on Windows and 3.something GB on Solaris). No.
    Windows 32 bit has a 2 GB application space and can be configured to allow a 3GB space.
    The Sun VM does not allow more because of the way that the executable is linked.
    [http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4358809]

  • Remove / unload external swf file(s) from the main flash file and load a new swf file and garbage collection from memory.

    I can't seem to remove / unload the external swf files e.g when the carousel.swf (portfolio) is displayed and I press the about button the about content is overlapping the carousel (portfolio) . How can I remove / unload an external swf file from the main flash file and load a new swf file, while at the same time removing garbage collection from memory?
    This is the error message(s) I am receiving: "TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/removeChild()
    at index_fla::MainTimeline/Down3()"
    import nl.demonsters.debugger.MonsterDebugger;
    var d:MonsterDebugger=new MonsterDebugger(this);
    stage.scaleMode=StageScaleMode.NO_SCALE;
    stage.align=StageAlign.TOP_LEFT;
    stage.addEventListener(Event.RESIZE, resizeHandler);
    // loader is the loader for portfolio page swf
    var loader:Loader;
    var loader2:Loader;
    var loader3:Loader;
    var loader1:Loader;
    //  resize content
    function resizeHandler(event:Event):void {
        // resizes portfolio page to center
    loader.x = (stage.stageWidth - loader.width) * .5;
    loader.y = (stage.stageHeight - loader.height) * .5;
    // resizes about page to center
    loader3.x = (stage.stageWidth - 482) * .5 - 260;
    loader3.y = (stage.stageHeight - 492) * .5 - 140;
    /*loader2.x = (stage.stageWidth - 658.65) * .5;
    loader2.y = (stage.stageHeight - 551.45) * .5;*/
    addEventListener(Event.ENTER_FRAME, onEnterFrame,false, 0, true);
    function onEnterFrame(ev:Event):void {
    var requesterb:URLRequest=new URLRequest("carouselLoader.swf");
    loader = null;
    loader = new Loader();
    loader.name ="carousel1"
    //adds gallery.swf to stage at begining of movie
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader.load(requesterb);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader);
    loader.x = (stage.stageWidth - 739) * .5;
    loader.y = (stage.stageHeight - 500) * .5;
    // stop gallery.swf from duplication over and over again on enter frame
    removeEventListener(Event.ENTER_FRAME, onEnterFrame);
    //PORTFOLIO BUTTON
    //adds eventlistner so that gallery.swf can be loaded
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    function Down(event:MouseEvent):void {
    // re adds listener for contact.swf and about.swf
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    //unloads gallery.swf from enter frame if users presses portfolio button in nav
    var requester:URLRequest=new URLRequest("carouselLoader.swf");
        loader = null;
    loader = new Loader();
    loader.name ="carousel"
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader);
    loader.x = (stage.stageWidth - 739) * .5;
    loader.y = (stage.stageHeight - 500) * .5;
    removeChild( getChildByName("about") );
    removeChild( getChildByName("carousel1") );
    // remove eventlistner and prevents duplication of gallery.swf
    MovieClip(root).nav.portfolio.removeEventListener(MouseEvent.MOUSE_DOWN, Down);
    //INFORMATION BUTTON
    //adds eventlistner so that info.swf can be loaded
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    function Down1(event:MouseEvent):void {
    //this re-adds the EventListener for portfolio so that end user can view again if they wish.
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    var requester:URLRequest=new URLRequest("contactLoader.swf");
    loader2 = null;
    loader2 = new Loader();
    loader2.name ="contact"
    loader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader2.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader2);
    loader2.x = (stage.stageWidth - 658.65) * .5;
    loader2.y = (stage.stageHeight - 551.45) * .5;
    // remove eventlistner and prevents duplication of info.swf
    MovieClip(root).nav.info.removeEventListener(MouseEvent.MOUSE_DOWN, Down1);
    //ABOUT BUTTON
    //adds eventlistner so that info.swf can be loaded
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    function Down3(event:MouseEvent):void {
    //this re-adds the EventListener for portfolio so that end user can view again if they wish.
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    var requester:URLRequest=new URLRequest("aboutLoader.swf");
    loader3 = null;
    loader3 = new Loader();
    loader3.name ="about"
    loader3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader3.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader3);
    loader3.x = (stage.stageWidth - 482) * .5 - 260;
    loader3.y = (stage.stageHeight - 492) * .5 - 140;
    removeChild( getChildByName("carousel") );
    removeChild( getChildByName("carousel1") );
    // remove eventlistner and prevents duplication of info.swf
    MovieClip(root).nav.about.removeEventListener(MouseEvent.MOUSE_DOWN, Down3);
    stop();

    Andrei1,
    Thank you for the helpful advice. I made the changes as you suggested but I am receiving a #1009 error message even though my site is working the way I wan it to work. I would still like to fix the errors so that my site runs and error free. This is the error I am receiving:
    "TypeError: Error #1009: Cannot access a property or method of a null object reference."
    I'm sure this is not the best method to unload loaders and I am guessing this is why I am receiving the following error message.
         loader.unload();
         loader2.unload();
         loader3.unload();
    I also tried creating a function to unload the loader but received the same error message and my portfolio swf was not showing at all.
         function killLoad():void{
         try { loader.close(); loader2.close; loader3.close;} catch (e:*) {}
         loader.unload(); loader2.unload(); loader3.unload();
    I have a question regarding suggestion you made to set Mouse Event to "null". What does this do setting the MouseEvent do exactly?  Also, since I've set the MouseEvent to null do I also have to set the loader to null? e.g.
    ---- Here is my updated code ----
    // variable for external loaders
    var loader:Loader;
    var loader1:Loader;
    var loader2:Loader;
    var loader3:Loader;
    // makes borders resize with browser size
    function resizeHandler(event:Event):void {
    // resizes portfolio page to center
         loader.x = (stage.stageWidth - loader.width) * .5;
         loader.y = (stage.stageHeight - loader.height) * .5;
    // resizes about page to center
         loader3.x = (stage.stageWidth - 482) * .5 - 260;
         loader3.y = (stage.stageHeight - 492) * .5 - 140;
    //adds gallery.swf to stage at begining of moviie
         Down();
    //PORTFOLIO BUTTON
    //adds eventlistner so that gallery.swf can be loaded
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    function Down(event:MouseEvent = null):void {
    // re adds listener for contact.swf and about.swf
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    //unloads gallery.swf from enter frame if users presses portfolio button in nav
         var requester:URLRequest=new URLRequest("carouselLoader.swf");
         loader = new Loader();
         loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader.load(requester);
         } catch (error:SecurityError) {
         trace(error);
         this.addChild(loader);
         loader.x = (stage.stageWidth - 739) * .5;
         loader.y = (stage.stageHeight - 500) * .5;
    // sure this is not the best way to do this - but it is unload external swfs
         loader.unload();
         loader2.unload();
         loader3.unload();
    // remove eventlistner and prevents duplication of gallery.swf
         MovieClip(root).nav.portfolio.removeEventListener(MouseEvent.MOUSE_DOWN, Down);
    //INFORMATION BUTTON
         //adds eventlistner so that info.swf can be loaded
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         function Down1(event:MouseEvent = null):void {
         //this re-adds the EventListener for portfolio so that end user can view again if they wish.
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
         var requester:URLRequest=new URLRequest("contactLoader.swf");
         loader2 = null;
         loader2 = new Loader();
         loader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);    
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader2.load(requester);
    }      catch (error:SecurityError) {
         trace(error);
         addChild(loader2);
         loader2.x = (stage.stageWidth - 658.65) * .5;
         loader2.y = (stage.stageHeight - 551.45) * .5;
    loader.unload();
    loader2.unload();
    loader3.unload();
         // remove eventlistner and prevents duplication of info.swf
         MovieClip(root).nav.info.removeEventListener(MouseEvent.MOUSE_DOWN, Down1);
    //ABOUT BUTTON
         //adds eventlistner so that info.swf can be loaded
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
         function Down3(event:MouseEvent = null):void {
         //this re-adds the EventListener for portfolio so that end user can view again if they wish.
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         var requester:URLRequest=new URLRequest("aboutLoader.swf");
         loader3 = null;
         loader3 = new Loader();
         loader3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader3.load(requester);
    }      catch (error:SecurityError) {
         trace(error);
         addChild(loader3);
         loader3.x = (stage.stageWidth - 482) * .5 - 260;
         loader3.y = (stage.stageHeight - 492) * .5 - 140;
         loader.unload();
         loader2.unload();
         loader3.unload();
         // remove eventlistner and prevents duplication of info.swf
         MovieClip(root).nav.about.removeEventListener(MouseEvent.MOUSE_DOWN, Down3);
         stop();

  • Garbage Collection not releasing memory properly

    Hello, In my web application memory is not releasing properly, after some point of time application throw out of memory error, we are using tomcat5, jdk5, my heap size is half of the RAM.Garbage Collection not releasing memory properly.

    sabre150 wrote:
    punter wrote:
    georgemc wrote:
    Yep. Couldn't be a problem with your code, it must be that garbage collection doesn't work and nobody else noticed. Raise a bug with Sun.Are you serious ?You need to replace your sarcasm detector.I have blowed my sarcasm meter and limping in the blindness !!!! :(

  • I have a memory leak, objective-c 2.0, and garbage collector...

    the code i am using is a modification of the code/problem found in "Cocoa with Objective-C", chapter 3.
    i have tried to use the objective-c 2.0 garbage collector methodology, using @property, @synthesize, etc. when i run the code as listed below i get a leaking message.
    [Session started at 2008-02-01 23:33:37 -0500.]
    2008-02-01 23:33:38.070 SongsFoundationTool[28876:10b] * _NSAutoreleaseNoPool(): Object 0x2040 of class NSCFString autoreleased with no pool in place - just leaking
    Stack: (0x96b10178 0x96a3e0f8)
    2008-02-01 23:33:38.075 SongsFoundationTool[28876:10b] Song 1: We Have Exposive
    2008-02-01 23:33:38.076 SongsFoundationTool[28876:10b] * _NSAutoreleaseNoPool(): Object 0x2060 of class NSCFString autoreleased with no pool in place - just leaking
    Stack: (0x96b10178 0x96a3e0f8)
    2008-02-01 23:33:38.078 SongsFoundationTool[28876:10b] Song 2: Loops of Fury
    The Debugger has exited with status 0.
    when i include the commented out section, in the implementation file section, the description method, and use song1 and song2, in main, instead of song1.name and song2.name the program seems to run fine.
    The Debugger has exited with status 0.
    [Session started at 2008-02-01 23:38:24 -0500.]
    2008-02-01 23:38:24.375 SongsFoundationTool[28936:10b] Song 1: We Have Exposive
    2008-02-01 23:38:24.379 SongsFoundationTool[28936:10b] Song 2: Loops of Fury
    The Debugger has exited with status 0.
    please help me understand what's happening here.
    also, why was it necessary to use
    @property(copy, readwrite) NSString *name;
    @property(copy, readwrite) NSString *artist;
    instead of
    @property(readwrite) NSString *name;
    @property(readwrite) NSString *artist;
    thanks everyone, the code is below.
    // ....................... header file ...............
    #import <Cocoa/Cocoa.h>
    @interface Song : NSObject {
    NSString *name;
    NSString *artist;
    @property(copy, readwrite) NSString *name;
    @property(copy, readwrite) NSString *artist;
    @end
    //.................... the implementation file ..................
    #import "Song.h"
    @implementation Song
    @synthesize name;
    @synthesize artist;
    -(NSString *) description
    return [ self name ];
    @end
    //................................ main............................
    #import <Foundation/Foundation.h>
    #import "Song.h"
    int main (int argc, const char * argv[]) {
    Song *song1 = [ [ Song alloc ] init ];
    song1.name= @"We Have Exposive" ;
    [ song1 setArtist: @"The Future Sound Of Londown" ];
    Song *song2 = [ [ Song alloc ] init ];
    [ song2 setName: @"Loops of Fury" ];
    [ song2 setArtist: @"The Chemical Brothers" ];
    // Display Object
    NSLog( @"Song 1: %@", song1.name );
    NSLog( @"Song 2: %@", song2.name );
    // include statements below if -description method is uncommented
    // then comment out the two statements above. no memory leak if the code
    // is used from the statements below and - description is not commented out and
    // the two NSLog statements above are commented out.
    NSLog( @"Song 1: %@", song1 );
    NSLog( @"Song 2: %@", song2 );
    return 0;
    }

    Normally, your main only has a call to NSApplicationMain(). If you aren't doing a traditional MacOS X application, you will still want at least NSApplicationLoad() to get enough of the runtime to avoid those messages.
    I don't know for sure about the syntax of Objective-C 2.0. That stuff is all new. What error message are you getting that indicated that (copy, readwrite) is required? Could you provide a link to the actual example source? I did a quick check and assign and readwrite are the defaults. It is possible that readwrite by itself makes no sense. But I'm just guessing.

  • Memory leak in java / forcing garbage collection for unused resource?

    Is there any possibility in big programs if not designed properly for leakage of memory?
    If say i forget to force garbage collection of unused resouces what will happen?
    Even if i am forcing garbage collection how much assurity can be given to do so?
    I need answers w.r.t typical programming examples if someone can provide i will be happy.
    Or any useful link.
    Thanks
    Vijendra

    Memory leaks are usually much related with C/C++ programming since in that language you have direct access to memory using pointers.
    Now, in Java you do not have access to pointers, however you could still tie up your objects in a way that the garbage collection can not remove them.
    Basically, the grabage collection will search all the object implementation, and see if they are referenced or not. If not it will free that memory. However if you, somehow in you code allow a reference to your object then the garbage collection will not displose of that object.
    An example I can think of is when developing web applications. For example storing objects in the session will mean that you will have a reference to the object from the session, therefore the garbage collection will not free up the meomry taken by those objects untill the session has expired.
    That is how I know it... at least that is how they tought it to me!
    regards,
    sim085

  • 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

  • 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();}

  • Memory handling and garbage collection?

    Sorry, these are the correct snippets of code, of course:
    public class Test {
         public static void main(String[] args) {
              byte[] b = new byte[10000000];
              b = null;
              while(true) {}
    public class Test {
         public static void main(String[] args) {
              new Test();
         public Test()
              byte[] b = new byte[10000000];
              b = null;
              zzz();
         public synchronized void zzz()
              try
                   wait();
              catch(Throwable t) {}

    Oh god this is all messed up... Original message then:
    Hi all!
    I'm just interested in the way that Java handles garbage and frees memory, as I have seen some problems with this in the chat server I'm building. I was under the impression that you could remove a reference to something and the memory allocated by it would automatically free up.
    I wrote a stupid little test program that allocates a 10MB byte array and then immediately removes the reference to it. Using the Windows Task Manager I just compared the memory usage when allocating the huge array, to the usage when not. When using the array my program eats about 15MB of memory, while the amount when not using the array is about 5MB. So it's obvious that no memory at all is freed when I remove the reference to that array.
    public class Test {
         public static void main(String[] args) {
              byte[] b = new byte[10000000];
              b = null;
              while(true) {}
    }Ok so perhaps the Garbage Collector doesn't operate while in an endless loop. A little change to let the program get stuck in a wait() instead:
    public class Test {
         public static void main(String[] args) {
              new Test();
         public Test() {
              byte[] b = new byte[10000000];
              b = null;
              zzz();
         public synchronized void zzz() {
              try {
                   wait();
              catch(Exception e) {}
    }Unfortunately, the result is the same. Program eats 10MB of memory too much, and it wouldn't free up in the few minutes I waited anyway.
    Anyone at all have thoughts on this?
    Thanks

  • 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

Maybe you are looking for