Garbage collector - Tenured Generation - Unloading Class

Hi All,
I've seen the garbage collector report the following.  The worrying this is it took 36 seconds.  Is this normal, or is there something wrong with my generation (New, Perm, Tenured) sizes ?  What does this "Unloading Class" mean?
Thu Dec  7 10:06:20 2006
57165.190: [GC 57165.190: [ParNew: 676789K->676789K(682688K), 0.0000346 secs]57165.190: [Tenured
Thu Dec  7 10:06:34 2006
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor116]
[Unloading class sun.reflect.GeneratedConstructorAccessor819]
[Unloading class sun.reflect.GeneratedMethodAccessor1]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor256]
[Unloading class sun.reflect.GeneratedConstructorAccessor405]
[Unloading class sun.reflect.GeneratedMethodAccessor232]
[Unloading class sun.reflect.GeneratedMethodAccessor328]
[Unloading class sun.reflect.GeneratedConstructorAccessor989]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor212]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor37]
[Unloading class sun.reflect.GeneratedConstructorAccessor1032]
[Unloading class sun.reflect.GeneratedConstructorAccessor366]
[Unloading class sun.reflect.GeneratedConstructorAccessor89]
[Unloading class sun.reflect.GeneratedConstructorAccessor84]
[Unloading class sun.reflect.GeneratedConstructorAccessor336]
[Unloading class sun.reflect.GeneratedConstructorAccessor335]
[Unloading class sun.reflect.GeneratedConstructorAccessor1053]
[Unloading class sun.reflect.GeneratedConstructorAccessor418]
[Unloading class sun.reflect.GeneratedMethodAccessor320]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor86]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor274]
[Unloading class sun.reflect.GeneratedConstructorAccessor929]
[Unloading class sun.reflect.GeneratedConstructorAccessor893]
[Unloading class sun.reflect.GeneratedConstructorAccessor444]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor58]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor144]
[Unloading class sun.reflect.GeneratedConstructorAccessor132]
[Unloading class sun.reflect.GeneratedConstructorAccessor385]
[Unloading class sun.reflect.GeneratedConstructorAccessor767]
[Unloading class sun.reflect.GeneratedConstructorAccessor960]
Thu Dec  7 10:06:57 2006
: 1653530K->1018272K(2326528K), 36.6689289 secs] 2330319K->1018272K(3009216K), 36.6692910 secs]
Our server has 16GB of RAM.  The Heap size is currently set to 3GB.  The NewSize is 800MB and the Perm Size is 384MB.
Thanks in advance
Regards
Anthony Gray

Hi,
> Hi All,
>
> I've seen the garbage collector report the following.
> The worrying this is it took 36 seconds. 
That's for sure too long.
> Is this
> normal, or is there something wrong with my
> generation (New, Perm, Tenured) sizes ?  What does
>  this "Unloading Class" mean?
A class is unloaded, when it's not used anymore.
In your case its the unloading of classes that were automatically generated because of the use of Java reflection.
I mentioned that by the way just recently in my web log here : https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5138. [original link is broken] [original link is broken] [original link is broken] [original link is broken]
What JVM do you use and what is the operating system  ?
Regards,
Markus
>
> ****************************
> Thu Dec  7 10:06:20 2006
> 57165.190: [GC 57165.190: [ParNew:
> 676789K->676789K(682688K), 0.0000346 secs]57165.190:
> [Tenured
> Thu Dec  7 10:06:34 2006
> [Unloading class
> sun.reflect.GeneratedSerializationConstructorAccessor1
> 16]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor819]
> [Unloading class
> sun.reflect.GeneratedMethodAccessor1]
> [Unloading class
> sun.reflect.GeneratedSerializationConstructorAccessor2
> 56]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor405]
> [Unloading class
> sun.reflect.GeneratedMethodAccessor232]
> [Unloading class
> sun.reflect.GeneratedMethodAccessor328]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor989]
> [Unloading class
> sun.reflect.GeneratedSerializationConstructorAccessor2
> 12]
> [Unloading class
> sun.reflect.GeneratedSerializationConstructorAccessor3
> 7]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor1032]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor366]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor89]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor84]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor336]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor335]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor1053]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor418]
> [Unloading class
> sun.reflect.GeneratedMethodAccessor320]
> [Unloading class
> sun.reflect.GeneratedSerializationConstructorAccessor8
> 6]
> [Unloading class
> sun.reflect.GeneratedSerializationConstructorAccessor2
> 74]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor929]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor893]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor444]
> [Unloading class
> sun.reflect.GeneratedSerializationConstructorAccessor5
> 8]
> [Unloading class
> sun.reflect.GeneratedSerializationConstructorAccessor1
> 44]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor132]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor385]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor767]
> [Unloading class
> sun.reflect.GeneratedConstructorAccessor960]
> .
> .
> .
> .
> Thu Dec  7 10:06:57 2006
> : 1653530K->1018272K(2326528K), 36.6689289 secs]
> 2330319K->1018272K(3009216K), 36.6692910 secs]
>
> ************************************
> Our server has 16GB of RAM.  The Heap size is
> currently set to 3GB.  The NewSize is 800MB and the
> Perm Size is 384MB.
>
>
> Thanks in advance
>
> Regards
> Anthony Gray

Similar Messages

  • Swing components and the garbage collector

    How much care does one need to take with swing components, with reference to running out of stack space? I ask because I'm writing a system for an automotive parts company, and the company tends to not reboot the machines very often...
    Anyway... if a JFrame is closed, is it and all its components marked for GCing? Do I need to call the dispose method, or is this part of the default close behaviour? Or is there something else entirely?
    Cheers

    In class that calls for .setVisible(false) of one JFrame u MUST call
    for dispose() method.
    so
    myFrame.setVisible(false)
    myFrame.dispose()
    myFrame = null // to help the garbage collector
    If u have classes that becames from JFrame (or JDialog) u can
    invoke in its constructors:
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
    This makes uncecessary to call for dispose() method explicetly.
    If u do not have this kind of classes u can invoke this method
    after u have create your JFrame
    JFrame myFrame = new JFrame();
    myFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
    The most important thing is REMOVE ALL LISETNERS that u have added, so, if u have classes that becames from JFrame u can ovverride
    the dispose method to do that
    eg
    public void dispose()
    super.dispose()
    removeActionListener(.....)
    and so on
    If u do not have this kind of classes u must remove all listeners u have
    added before u invoke the setVisible(false) method.
    Regards

  • Garbage collector tuning. Permanent generation

    Hi all,
    I'm learning about garbage collector tuning.
    Why my system always gives for the permanent generation 8192K?
    And why is always full with 8191K? Maybe it is full because my application manages an internal java cache but ....
    Does it is OK that is always full?, how can I change its size?
    [Perm : 8191K->8191K(8192K)], 0.1922860 secs]
    I'm using Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
    Linux SuSE
    I'm using the following command
    java -XX:+PrintGCDetails -XX:NewRatio=3 -Xss256k -Xms128m -Xmx256m
    [Full GC [Tenured: 0K->2206K(98304K), 0.1920700 secs] 24643K->2206K(127808K), [Perm : 8191K->8191K(8192K)], 0.1922860 secs]
    [GC [DefNew: 26299K->1168K(29568K), 0.0566740 secs] 28505K->3374K(127872K), 0.0567870 secs]
    [GC [DefNew: 27472K->3264K(29568K), 0.0391920 secs] 29678K->6757K(127872K), 0.0392870 secs]
    [GC [DefNew: 29567K->3264K(29568K), 0.0756940 secs] 33061K->12212K(127872K), 0.0757840 secs]
    Thaks,

    Hi!
    In the permanent generation you have data like class information and static strings. This data is usually never garbage-collected since it never becomes garbage anyway (it is "permanent data"). Per default, the JVM starts with a very small perm gen (somewhere around 4 MB, I believe, but this may be system specific). The default max size for the perm gen is 64 MB on most systems.
    If your application needs more space in the perm gen than initially allocated, the JVM will enlarge the perm gen until your data fits into the perm gen (or the max size is reached). In your case your applications seems to need 8 MB perm space, therefore the JVM enlarges the perm gen until it is 8 MB large.
    So, to answer your question, it's totally ok that your perm gen is 8 MB large and always full. There is no need to change its size in your case. If you still want to do it, you can use -XX:PermSize=<initalSize> and -XX:MaxPermSize=<maxSize>. Setting -XX:PermSize=8m may speed up your application start a little since the JVM allocates enough space right in the beginning and doesn't need to enlarge the perm gen afterwards.
    Nick.

  • Strange garbage collector behaviour

    Hello,
    I am seeing quite a strange behaviour from the garbage collector in one of our applications.
    The application is a standalone Java app, it receives requests over a TCP socket and responds to them. It is basically a kind of a cache before the database. There is a constant request flow of 10-100 requests per second. Average response time is below 50ms. It is running on a multiprocessor Sun machine, JDK 1.4.1_02.
    The problem arises when the app has been running for a while. Depending on the allowed maximum memory size - with 256mb after about half a day, with 512mb after about a day, the garbage collector seems to be running most of the time. We turned on GC logging and from the log I can see that initially for a long period only the DefNew collector is used. The GC times are ~0.05sec then. Then after some time old generation collections start taking place. These collections take 3-4 seconds. The old gen collections then become more frequent until all that is going on, is one collection after another. About 3-4seconds for the collection, then after another 3-4 seconds the same thing again.
    Can anyone please help in understanding what can cause this kind of behaviour? I am quite sure that the app is stable in a sense that it doesn't start to eat up extra memory at some point.
    Any help greatly appreciated,
    erik
    Here are some excerpts from the GC log:
    After startup:
    100.264: [GC 100.264: [DefNew: 83488K->1290K(84800K), 0.0487560 secs] 87278K->5080K(259584K), 0.0490613 secs]
    107.439: [GC 107.439: [DefNew: 83530K->1299K(84800K), 0.0526107 secs] 87320K->5178K(259584K), 0.0528313 secs]
    111.554: [GC 111.554: [DefNew: 83539K->1207K(84800K), 0.0539021 secs] 87418K->5230K(259584K), 0.0541348 secs]
    119.724: [GC 119.724: [DefNew: 83447K->1359K(84800K), 0.0561691 secs] 87470K->5382K(259584K), 0.0564463 secs]
    125.576: [GC 125.576: [DefNew: 83599K->1366K(84800K), 0.0622342 secs] 87622K->5504K(259584K), 0.0624880 secs]
    130.987: [GC 130.987: [DefNew: 83606K->1331K(84800K), 0.0586104 secs] 87744K->5607K(259584K), 0.0588732 secs]
    138.695: [GC 138.695: [DefNew: 83571K->1296K(84800K), 0.0588720 secs] 87847K->5697K(259584K), 0.0591136 secs]
    144.413: [GC 144.413: [DefNew: 83536K->1246K(84800K), 0.0607789 secs] 87937K->5790K(259584K), 0.0612128 secs]
    150.661: [GC 150.661: [DefNew: 83486K->1279K(84800K), 0.0486299 secs] 88030K->5823K(259584K), 0.0488933 secs]
    157.186: [GC 157.187: [DefNew: 83519K->1410K(84800K), 0.0545036 secs] 88063K->5954K(259584K), 0.0547557 secs]
    162.937: [GC 162.937: [DefNew: 83650K->1230K(84800K), 0.0590144 secs] 88194K->5998K(259584K), 0.0592747 secs]
    171.555: [GC 171.555: [DefNew: 83470K->1334K(84800K), 0.0554568 secs] 88238K->6101K(259584K), 0.0557090 secs]
    175.416: [GC 175.416: [DefNew: 83574K->1315K(84800K), 0.0584964 secs] 88341K->6178K(259584K), 0.0587433 secs]
    182.616: [GC 182.616: [DefNew: 83555K->1307K(84800K), 0.0709417 secs] 88418K->6234K(259584K), 0.0712034 secs]
    And then in the end:
    13177.7: [GC 13177.7: [DefNew: 82240K->82240K(84800K), 0.0000487 secs]13177.7: [Tenured: 95861K->96094K(174784K), 3.7160279 secs] 178101K->96094K(259584K), 3.7165109 secs]
    13183.9: [GC 13183.9: [DefNew: 82240K->82240K(84800K), 0.0000459 secs]13183.9: [Tenured: 96094K->96268K(174784K), 3.6973634 secs] 178334K->96268K(259584K), 3.6978356 secs]
    13193: [GC 13193: [DefNew: 82240K->82240K(84800K), 0.0000534 secs]13193: [Tenured: 96268K->95923K(174784K), 4.6233189 secs] 178508K->95923K(259584K), 4.6237995 secs]
    13201.2: [GC 13201.2: [DefNew: 82240K->82240K(84800K), 0.0000531 secs]13201.2: [Tenured: 95923K->96100K(174784K), 3.7120306 secs] 178163K->96100K(259584K), 3.7125165 secs]
    13208.6: [GC 13208.6: [DefNew: 82240K->82240K(84800K), 0.0000502 secs]13208.6: [Tenured: 96100K->96268K(174784K), 3.6950267 secs] 178340K->96268K(259584K), 3.6955072 secs]
    13218.1: [GC 13218.1: [DefNew: 82240K->82240K(84800K), 0.0000582 secs]13218.1: [Tenured: 96268K->96442K(174784K), 3.7476890 secs] 178508K->96442K(259584K), 3.7481875 secs]
    13225.8: [GC 13225.8: [DefNew: 82240K->82240K(84800K), 0.0002743 secs]13225.8: [Tenured: 96442K->96200K(174784K), 4.9092106 secs] 178682K->96200K(259584K), 4.9103437 secs]
    13234.4: [GC 13234.4: [DefNew: 82240K->82240K(84800K), 0.0000541 secs]13234.4: [Tenured: 96200K->96409K(174784K), 3.7423712 secs] 178440K->96409K(259584K), 3.7428506 secs]
    13240.6: [GC 13240.6: [DefNew: 82240K->82240K(84800K), 0.0000528 secs]13240.6: [Tenured: 96409K->96633K(174784K), 3.6245501 secs] 178649K->96633K(259584K), 3.6250124 secs]
    13273.7: [GC 13273.7: [DefNew: 82240K->82240K(84800K), 0.0000651 secs]13273.7: [Tenured: 96633K->96799K(174784K), 3.7021988 secs] 178873K->96799K(259584K), 3.7027242 secs]
    13283: [GC 13283: [DefNew: 82240K->82240K(84800K), 0.0000510 secs]13283: [Tenured: 96799K->96620K(174784K), 4.9944806 secs] 179039K->96620K(259584K), 4.9949444 secs]
    I can provide the whole log if neccessary.

    The most likely cause of this problem is a memory leak in your application. As the memory reaches close to its limit the GC has to run for longer, more often to get free memory.
    The runtime before going slow being proportional to the memory size.
    Can you have the program log the System.freeMemory() and System.totalMemory()

  • Memory leak in "Tenured Generation" heap (JVM 1.5)?!

    For about over a year, I'm trying to hunt down the memory leak in our server application. But after all the improvements I've made (especially with 'forgotten' listeners that didn't exist anymore), I'm confident that the application doesn't have a memory leak anymore. At least the new "jconsole.exe" tool of JDK 1.5 shows me a very intersting behaviour:
    Even if the server app is doing nothing than one thread polling a database table for possible new jobs to process, the memory slightly increases over time ... very slightly. It's just like the screenshot at
    http://java.sun.com/j2se/1.5.0/docs/guide/management/jconsole.html#memory
    where you might find a very slight tendency up. I run jconsole the whole day to track the application on a computer where no jobs got processed, so the application only sit there there whole day and just one thread has a loop that polls a database table via JDBC and doesn't get a result. The result is, that the memory chart is like the chart in the screenshot of the link above just with much more jaggies. About every 20 minutes, garbage collection seems to kick in, as the jaggie line drops about several megabytes just to increase again slowly.
    Of course the thread loop creates objects but it doesn't hold any (debugged it several times and it is quite easy code). So this behaviour makes sense. But it doesn't make sense that the memory usage overall slowly increases over many hours (ultimativaly leading to an OutOfmemoryError).
    So far, I still thought, it must be a memory leak in my application. But then, I played with jConsole and noticed this: if I just display the Memory Pool "Eden Space", the jagged line always drops down to the same level, i.e. no memroy leak. The "Survivor Space" is also constant in average (no memory leak). But the "Tenured Generation" line shows this memroy leak behaviour (slowly increases). This space is described as:
    Tenured Generation (heap): pool containing objects that have existed for some time in the survivor space.
    So, I'm not so sure anymore if this memory must be in my application. Unfortunately, jConsole doesn't show some kind of object tree that can be browsed and I would see what kind of object (collection) increase.
    I tried profiling my application, but the profiled app runs so slowly that it would need many days or weeks until it's possible to identify some bad objects.
    Is there another way to identify such memory waisters?

    Write a main() that does the polling in a tight loop 1000 times. Then System.gc(); Thread.sleep(1000); System.exit(). Run the thing with -Xrunhprof. Observe the "live bytes" and "live objs" columns in the generated java.hprof.txt file. Anything that strikes as suspicious? If every polling round leaks one object, there's likely to be 1000 (or N*1000) of something live. Make sure the leak is in the polling routine by running it 1,000,000 rounds and getting an OutOfMemory.

  • Clear method and Garbage Collector

    Hi Gurus,
    Does the Clear method (hashtable, vector etc..) is a good option for garbage collection ?
    In other words, if I have a vector V with 100 elements and I perform a V.clear(), am I sure that the 100 elements are now candidates for the Garbage Collection ?
    Or is it better to write a loop performing a NULL assignment for each element of the vector ?

    Hi schapel,
    I know it's not a good idea to force the garbage collector, but let me explain what I am confronted with.
    (FYI, I didn't write the source code. Comes from a 3rd party)
    The aim is to build a jsp page which is the list of the files contained in a web server directory.
    I have a "Directory" class, and a "File" class. To build the jsp, each directory of the webserver is represented by a directory class, and each file, ...by a file class.
    To simplify, when the tree structure of the web server is build in memory, I create a jsp page to list the files, and then, I do not need the vector anymore. But the vector can be quite huge and each client will build his own vector at the begening of his session (and will never use it again during the session).
    Don't you think it's usefull in that situation to free some memory ?

  • Garbage collector

    Bonjour à la communauté Adobe et merci pour les
    éventuelles réponses que je trouverai grâce à
    vous.
    Je relance je pense une fois de plus, comme sur de nombreux
    forums, le problème du Garbage Collector.
    J'ai un MovieClip crée dynamiquement. Ce MovieClip
    contient un objet vidéo contrôlé et géré
    dynamiquement via une classe (cette partie n'est pas bien
    importante je suppose); bref je voudrais pouvoir supprimer
    complètement ce clip, mais même après un
    "removeChild(clip)" et un "clip = null", j'entend toujours le son
    de la vidéo... ce qui me fait dire qu'il est toujours
    matériellement présent, mais pourquoi??
    mon code :
    var mavideo:MovieClip;
    mavideo = new monclip();
    addChild(mavideo);
    removeChild(mavideo);
    mavideo = null;
    System.gc();//j'ai même essayé de forcer le Garbage
    Collector, sans succès.
    Voilà donc ma question globale : comment supprimer
    complètement un clip en as3?
    Sorry for my bad english, but the question is : how to
    completely delete a MovieClip using AS3? If I remove a MovieClip
    which include a video, with the code below, i don't see the video
    anymore but i can hear the sound... Strange, isn't it?

    Bonjour à la communauté Adobe et merci pour les
    éventuelles réponses que je trouverai grâce à
    vous.
    Je relance je pense une fois de plus, comme sur de nombreux
    forums, le problème du Garbage Collector.
    J'ai un MovieClip crée dynamiquement. Ce MovieClip
    contient un objet vidéo contrôlé et géré
    dynamiquement via une classe (cette partie n'est pas bien
    importante je suppose); bref je voudrais pouvoir supprimer
    complètement ce clip, mais même après un
    "removeChild(clip)" et un "clip = null", j'entend toujours le son
    de la vidéo... ce qui me fait dire qu'il est toujours
    matériellement présent, mais pourquoi??
    mon code :
    var mavideo:MovieClip;
    mavideo = new monclip();
    addChild(mavideo);
    removeChild(mavideo);
    mavideo = null;
    System.gc();//j'ai même essayé de forcer le Garbage
    Collector, sans succès.
    Voilà donc ma question globale : comment supprimer
    complètement un clip en as3?
    Sorry for my bad english, but the question is : how to
    completely delete a MovieClip using AS3? If I remove a MovieClip
    which include a video, with the code below, i don't see the video
    anymore but i can hear the sound... Strange, isn't it?

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

  • How does the Garbage Collector handle reference-free objects?

    Hi,
    I am interested to know how the GC handle's objects created
    without a reference.
    The reason this has become of interest to me is that I have
    created a "Title" class. The Title class animates each letter of
    Title.text to appear in a cloud of smoke.
    The smoke is a simple particle system class, when a particle
    dies it removes it's associated MovieClip so that eventually all
    MovieClip's have been destroyed.
    Now in the Title class for each letter I do the following
    (psuedo-code):
    for( Title.text.length) {
    CurrentLetter.twAlpha = new Tween( blah, blah, blah); //
    object created
    with a reference
    new Smoke( CurrentLetter.x, CurrentLetter.y); // object
    created
    without a reference
    Although this is technique is not one I would ever have
    thought of in a language that doesn't use a garbage collector it is
    mentioned in the Tween documentation and my class works as
    intended.
    The thing is although it works, it always bothers me when I
    don't know precisely
    why it works!
    If it's working due to the short life span of the class in
    question and thus simply missing the GC's window then this could be
    problematic. If at some point it is still alive when the GC is
    called then my class could be prematurely deleted.
    Maybe a class which has a reference to an "alive" MovieClip
    is immune from GC?
    I Hope someone can shed some light on this topic as the GC is
    something that is thinly documented to say the least!
    :theory
    p.s. first post!

    Hi,
    I would say it would be better use FREE itab at the end of the processing in your code. In the end-of-selection in your code, you can FREE all your itabs that were used in the program. This is one of the good approach of optimizing the memory.
    Regards
    Vimal

  • How intelligent is the garbage collector?

    Hi all,
    I've got a question about how garbage collection works in an ABAP objects context.
    If there are no more references an object is cleaned up and the memory released. Fine.
    What about an object O1, which in turn creates another object O2. O2 however also contains a refernce to O1.
    When the original process completes, this leaves two objects that reference each other, but with no other contact to the 'outside world'. Is the garbage collector intelligent enough to dump them?
    Any input appreciated,
    Cheers
    Mike

    Hi,
    Thanks for the feedback. I am still not sure - you say 'when the program ends it's part'. This is exactly the point - when the program ends, do the objects remain because they still contain references to each other?
    More detail:
    The references are public instance attributes of both objects (different classes). I would prefer to use functional methods, but am stuck with public attributes which I'm populating in the constructor.
    So a process P declares a local var LV_O1 and does a CREATE OBJECT LV_O1.
    In the constructor of O1, it does a
    CREATE OBJECT me->ATTR_O2 to populate it's attribute with a reference to an instance of O2.
    O2 doesn't need to do a CREATE OBJECT, but assigns a ref to O1 to it's attribute ATTR_O1.
    So now O1 and O2 refer to each other by public attributes:
    O1->ATTR_O2 and O2->ATTR_O1.
    The big question is what happens when process P ends and it's variable LV_O1 ceases to exist?
    In case anyone's wondering about the overall wisdom of the design, they have to be public attributes (used in Workflow) and they have to refer to each other as instantiation may also happen the other way around.
    Cheers
    Mike

  • How the protected finalize method is called by garbage collector

    Dear All,
    I have a double regarding the calling mechanism of finalize method. The access specifier of finalize method is protected, not only that if a class overrides this method then also the finalize method can be protected in the subclass of Object. But the concept of protected access specifier is, from outside of the package it can be accessed only from subclass.
    The program (may be part of Garbage collector), which calls this (finalize) method mast not be in the same package (that is java.jang) nor it is a subclass of the class (whose finalize method it calls).
    Then how the finalize method is getting called by the garbage collector when it is protected?
    Regards,
    Gourab

    Refer to following link for the details
    http://www.me.umn.edu/~shivane/blogs/cafefeed/2005/09/why-is-finalize-method-protected.html
    The link gives answer to how a protected/private members are accessible to JVM or GC and why finalize is declared protected.

  • Get Garbage Collector Details

    Hi,
    I'm using ALBPM 6.0.4 standalone on a windows 2003.
    I'm tunning the application, but when i trying to get the garbage collector details i don't get the log file.
    i already set this arguments -Xloggc:../log/engine-max-gc.log -XX:+PrintGCDetails on Additional java arguments used in startup on execution tab.
    I'm not sure if the engine takes this arguments on start up.
    i'm doing something wrong?
    Thanks in advance,
    Helios.

    See the javadocs for DatabaseMetaData class under java.sql

  • Understanding garbage collector output

    Hi all.
    My application uses an increasing amount of memory, and in order to solve the problem I have turned on the -verbosegc option. The output is as follows:
    <GC: managing allocation failure: need 1040 bytes, type=1, action=1>
    <GC: 504 milliseconds since last GC>
    <GC: freed 6530 objects, 288432 bytes in 10 ms, 35% free (661616/1887424)>
      <GC: init&scan: 1 ms, scan handles: 7 ms, sweep: 2 ms, compact: 0 ms>
      <GC: 4 register-marked objects, 7 stack-marked objects>
      <GC: 8 register-marked handles, 136 stack-marked handles>
      <GC: refs: soft 0 (age >= 32), weak 0, final 1, phantom 0>
    <GC: managing allocation failure: need 1040 bytes, type=1, action=2>
    <GC: 10 milliseconds since last GC>
    <GC: expanded object space by 1048576 to 2936000 bytes, 58% free>
    <GC: need to expand mark bits to cover 2560 bytes>Is any one able to explain this output for me? My problem is that the object space is expanded regularly and eventually the garbage collector writes "totally out of heap space" and an OutOfMemoryError occurs.
    My -version is
    java version "1.3.0"
    Java(TM) 2 Runtime Environment, Standard Edition
    Classic VM (build 1.3.0-1, native threads, jit)running on UNIX, Digital Alpha.
    Regards,
    Torben Lange

    Just a follow up on my memory leak problem which I have solved now.
    I had created a class which handles database connections. The constructor looked something like this:
    Connection connection;
    public DBConnection() {
      DriverManager.registerdriver(new myDriver());
      connection = DriverManager.getConnection(...);
    }My application creates an object of this class, uses it and then closes the object. This goes on all the time. (Yes, it could be handled another way by pooling database access or simply keep the connection open without closing it - but it isn't.)
    It seems that the registration of the driver in the constructor eventually will fill the memory - apparently the same driver is registered several times.
    Problem was solved when changing the code into the following:Connection connection;
    static boolean isRegistered = false;
    public DBConnection() {
      if (! isRegistered) {
        DriverManager.registerdriver(new myDriver());
        isRegistered = true;
      connection = DriverManager.getConnection(...);
    }Hope this could help others in the same situation.
    Regards,
    Torben Poort Lange

  • Web application Unloading classes of WL Stubs every several hours

    Hello,
    We have a WEB applications, which connects to Server Application using EJB technology - both deployed on the same
    domain on Weblogic 10.
    Recently, we started to experience a strange phenomenon - WEB application's threads get stalled and get a STUCK
    state.
    Sometimes, it is accompanied with the java.lang.OutOfMemoryError exception.
    Only reboot helps to recover from it.
    Trying to identify a problem we added some parameters to get some more information in the application logs.
    What we found is that once in a while (depend on a system load), we see the following messages in console logs:
    [Unloading class <class name>]
    These are the examples about how often the events happen and it’s durations:
    2011-01-30 10:14:11 - 2011-01-30 10:14:28
    2011-01-30 12:27:51 - 2011-01-30 12:28:08
    2011-01-30 13:59:46 - 2011-01-30 14:00:02
    2011-01-30 14:56:59 - 2011-01-30 14:57:13
    2011-01-30 14:57:46 - 2011-01-30 14:58:00
    2011-01-30 17:11:21 - 2011-01-30 17:11:39
    2011-01-30 18:29:24 - 2011-01-30 18:29:44
    2011-01-30 20:05:34 - 2011-01-30 20:05:53
    2011-01-30 21:48:39 - 2011-01-30 21:48:55
    . - Each time are about 20000 - 30000 classes are unloaded.
    . - About 150000 classes are unloaded daily,
    ........- 90% out of it are the classes, which ends with "*..Impl_1001_WLStub*"
    ............- 30% out of Stubs are Home Stubs, which ends with "*..HomeImpl_1001_WLStub*"
    *(!) The most interesting that out of all this huge amount of classes, which are unloaded daily,*
    only +23+ types of different Stubs are unloaded, whereas out of it +10+ different Home Stubs:
    $> grep "Unloading class.*Impl_1001_WLStub" Web1.out | sort -u | wc -l
    23
    $> grep "Unloading class.*HomeImpl_1001_WLStub" Web1.out | sort -u | wc -l
    10Sometimes (as I said above) it ends with the "+java.lang.OutOfMemoryError+" exception.
    So, the questions are:
    1. What could be a reason for such behavior of a system?
    2. What message "Unloading class" says?
    3. Is it normal that (as you see from above), the same type of Stubs are loaded?
    It looks like a new Stub is created for every EJB invocation, isn't it?
    Is it normal? If not, what could be a reason for this?
    --------------- S Y S T E M ---------------
    jvm_args: -Xms2048m -Xmx2048m -XX:MaxPermSize=512m
    OS: Solaris 10 5/08 s10s_u5wos_10 SPARC
    uname:SunOS 5.10 Generic_142900-02 sun4v (T2 libthread)
    rlimit: STACK 8192k, CORE 1024000k, NOFILE 65536, AS infinity
    CPU:total 64 has_v8, has_v9, has_vis1, has_vis2, is_ultra3, is_sun4v, is_niagara1
    Memory: 8k page, physical 66977792k
    vm_info: Java HotSpot(TM) Server VM (1.5.0_11-b03) for solaris-sparc, built on Dec 15 2006 01:18:11

    You could see how your memory is managed by the JVM, by using for example a tool such as jconsole.
    Unloading class means that loaded classes are garbage collected. To see when the classes are loaded
    you can use the JVM option -verbose:class. I think somehow you are constantly loading the classes in the application,
    maybe by creating the stub over and over again when you need it. You can create the stub once by using
    a singleton pattern.
    A good overview of the available tools for the Sun JVM is given here: http://www.oracle.com/technetwork/java/javase/index-137495.html

  • Unloading class sun.reflect.GeneratedConstructorAccessor

    Hello All,
    I have thousands of lines in my log combined with "concurrent mode failure"
    [Unloading class sun.reflect.GeneratedConstructorAccessor1941]
    [Unloading class sun.reflect.GeneratedConstructorAccessor2003]
    [Unloading class sun.reflect.GeneratedMethodAccessor1184]
    [Unloading class sun.reflect.GeneratedConstructorAccessor1994]
    [Unloading class sun.reflect.GeneratedConstructorAccessor1977]
    [Unloading class sun.reflect.GeneratedConstructorAccessor1999]
    [Unloading class sun.reflect.GeneratedConstructorAccessor1976]
    [Unloading class sun.reflect.GeneratedConstructorAccessor1981]
    [Unloading class sun.reflect.GeneratedConstructorAccessor1921]
    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor1758]
    [Unloading class sun.reflect.GeneratedConstructorAccessor1993]
    [Unloading class sun.reflect.GeneratedMethodAccessor1177]
    Does it mean that permanent generation have a small size and the class is constantly unloaded?
    Thanks

    Don't do this.
    http://java.sun.com/products/jdk/faq/faq-sun-packages.html

Maybe you are looking for

  • How can I reset Pages after a failed update attempt?

    I tried to download an update to Pages while away from home and my WiFi network. The updater instructed me to either download the update from a WiFi connection or to use my MacBook to download the update and sync my iPad afterward. Home is 700 miles

  • System / transport acknowledgement

    Is it possible to view the System / transport acknowledgement for a message that was sent out from XI in the XI Message Monitor? If yes, how? Thanks.

  • Display Key & Text In Variable Screen

    Hi All, I am having one master data Location having Attribute and Text data loaded. I am using the same Location as a characteristics in my DSO and then in Query . Now, i have create one variable on Location. When i am executing the query , and click

  • Acrobat 9 and Document Center

    There are no instructions on how to use Acrobat 9 to set rights/permissions for documents to be controlled by Document Center. How do we do this? (Don't want to have to buy Acrobat 8 just to use Document Center). Thanks, Paul

  • PSE11, Windows 8, Email

    When I try to send an email with an attached photo via Photoshop Elements 11 I get the message "Error trying to save message to Outlook" and then nothing happens and no email is sent. Have tried to change email client in preferences/sharing but only