My recommendation is to stop trying to make sense of the output from
top and ps, and go to an unambiguous source. Take a look at the contents
of /proc/<pid>/status, where <pid> is the process ID. This will, at any
instant you examine it, give you (among other things) total current VM
usage and RSS.
BTW, I haven't seen any evidence that the JVM gives memory back to the
system. Doing such a thing isn't impossible, but it is difficult; OTOH,
systems with garbage-collection are those most able to implement such
a capability.
Nathan
On Sat, Nov 27, 1999 at 06:12:03AM -0800, Bradley Rosser wrote:
> --- Nelson Minar <[EMAIL PROTECTED]> wrote:
> >
> > >Essentially, RSS reflects how much of the program's address space
> > has
> > >been touched recently, as well as the kernel's decision about how
> > to
> > >allocate physical memory among processes that need it.
> >
> > Yes, the RSS is the most useful number. The VSZ for a Java process
> > is
> > just going to be the maximum heap. Ie: you run "java -mx128M", and
> > VSZ
> > will be 128M.
>
> But that's not the case - at least not on my Linux 2.2.12 system
> with Blackdown 1.2preV2.
>
> I understand what RSS is, and what the 'SIZE' column should be -
> the virtual memory size. And I also would have thought that the
> latter would be the total amount of memory that java grabs at the
> beginning (just like 'ps' reports). But I've found that *both*
> SIZE and RSS vary as the java program uses and releases memory.
> I do a System.gc() and the SIZE will drop from 140Mb down to
> about 50Mb (with RSS following suit, to be <= SIZE, of course).
>
> Can I ask a couple of other memory related questions? My
> java application prints a number of pages of output, doing
> drawImages() of a number of images per page - memory used
> increases dramatically. At the end of the print process all
> the Image objects are released, yet the memory-used doesn't
> drop at all - I have to do an explicit gc(). When does java's
> normal garbage collection cycle kick in? I wait a couple of
> minutes but it doesn't reduce memory of its own accord.
>
> The application has a menu option which does a System.gc() so I
> can explicitly initiate collection. I click on it once, and
> the SIZE/RSS go from 140+Mb down to about 80Mb. I click on it again,
> and it drops to 60-odd. I click on it again, we're down to 50Mb,
> etc.
> What are the mechanics of garbage collection? I would have thought
> that a single pass would free up everything that isn't referenced.
>
> Thanks,
>
>
>
> Brad Rosser
>
> __________________________________________________
> Do You Yahoo!?
> Thousands of Stores. Millions of Products. All in one place.
> Yahoo! Shopping: http://shopping.yahoo.com
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]