Hi Biju, When u start a java program, you can pass options to the jvm. There is an option "-verbose:gc" which gives you the output on the console when the garbage collector runs. There you an output like [GC 900k->250k (1416k), 0.0033920s] (this is just an example, sorry for any typos)
Now these are the same values you will get from Runtime.getRuntime().freeMemory() and .totalMemory() . With the above example, you will get the values of (1416k - 250k) and 1416k respectively. But unfortunately my problem was not exposed from this output. The problem was in native code, where in there were large numner of blocks of memory with no owners. Refer to Uncle George's reply in this discussion thread for more info on this. Hope it helps, -sourabh --- Biju Abraham Mathew <[EMAIL PROTECTED]> wrote: > HI Sourabh, > What do you mean when you say GC remains the > same? How do you find > it out? > I sit that java.lang.freememory() remains the same? > A reply will be appreciated. > Thanks, > -Biju Matew > > kulkarni sourabh wrote: > > > Hi Uncle George, > > I also tried with the same thing of top and GC > > output. I had earlier noticed only on GC output, > > because top was not ported on my environment. > However, > > after i observed both of them now, I have found > that > > top output goes on increasing while GC remains the > > same (at around 300-700k). > > I have a native program in C which reads shared > > memory. When I commented the call to the native > method > > and wrote some dummy thing there, the jvm doesn't > > increase now. I think there is some problem in my > > native code now. Thanks a lot since with ur hint i > > could isolate the problem. > > However, in native code also there is releasing > of > > the arrays and other things. (The native code is > > written by some other person and i don't know much > > details about JNI either). Can you help me with > some > > check points to find out the problem? > > Thanks a lot again, > > -sourabh > > > > --- Uncle George <[EMAIL PROTECTED]> wrote: > > > my out of mem error is/was due to the failure of > > > GZIPOutputStream to > > > release its memory fetched outside of GC. > > > I used "top" to display the amount of mem used > by > > > the active process. If > > > that grows larger as your GC stays the same, > then u > > > have a mem leak > > > outside of GC. > > > I then looked at the contents of /proc/PID/maps > . > > > These are memory > > > mappings for large chunks of main memory. If u > have > > > a lot of them with > > > no ownership ( ie to a library ) then u are > losing > > > it that way. But now > > > u have a way to localize when MORE chuncks are > > > allocatoed but not > > > released. > > > Sometimes I get an outta memory message because > the > > > Awt/graphics eats up > > > too much memory. remember that some objects do > not > > > release their > > > resources even if the object is completely > > > destroyed! ( this is > > > sometimes the fault of the JVM in its inability > to > > > process finalize > > > properly - if at all ) > > > > > > /gat > > > > > > kulkarni sourabh wrote: > > > > > > > > Hi Alexander, > > > > I have traced through my code thoroughly > and > > > there > > > > is no memory leak. I > > > > have also printed the Garbage Collector's > output. > > > The > > > > hil to > > > > > [EMAIL PROTECTED] > > > > > with a subject of "unsubscribe". Trouble? > > > Contact > > > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > __________________________________________________ > > > > Do You Yahoo!? > > > > Find the one for you at Yahoo! Personals > > > > http://personals.yahoo.com > > > > > > > > > > > > > > ---------------------------------------------------------------------- > > > > To UNSUBSCRIBE, email to > > > [EMAIL PROTECTED] > > > > with a subject of "unsubscribe". Trouble? > Contact > > [EMAIL PROTECTED] > > > > __________________________________________________ > > Do You Yahoo!? > > Find the one for you at Yahoo! Personals > > http://personals.yahoo.com > > > > > ---------------------------------------------------------------------- > > To UNSUBSCRIBE, email to > [EMAIL PROTECTED] > > with a subject of "unsubscribe". Trouble? Contact > [EMAIL PROTECTED] > __________________________________________________ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1 ---------------------------------------------------------------------- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]