I'm guessing you don't know how to read memory usage of an app. Any shared 
libraries used by any process, including all the memory it uses and all the 
shared libraries it brings in, all 'count'. So, the same library shows up 
for lots of processes. These days just the core OS library is gigantic, for 
example. This isn't really memory used by the app of course, and java links 
into a _lot_ of shared libraries. It's not as simple as just showing a 
process' own usage minus all the shared libraries, because some 'shared' 
libraries are really just used by the one app, so they should count. Art, 
not a science. Best thing to do is to measure free mem, then fire up a JVM, 
do some stuff, and recheck, except that too is problematic, as free mem is 
itself a wobbly number; OSes will keep processes around in case they are 
soon restarted, and all sorts of freed memory isn't actually freed because 
its more efficient to do so in batch form.

The upshot of all this is that it's virtually impossible to accurately 
measure memory load for any given app with the tools that ship with OSes to 
do so. Sounds like the kind of thing that ought to be trivial to measure but 
it isn't.

On Saturday, August 13, 2011 1:25:57 PM UTC+2, mgkimsal wrote:
>
> Why, then, on my JVM web app, when I specify -Xmx2g, do I see a Java 
> process 
> eating up 10g on my system?  -Xmx doesn't seem to honor anything I 
> give it - 
> it just uses up all the memory on my server. 
>
>
>
> On Aug 12, 11:53 am, PhilDin <philb%[email protected]> wrote: 
> > I've always wondered about this, before I encountered OOM, I just 
> > assumed that the JVM would keep asking for memory until the underlying 
> > OS refused to give it any more. Then, when I found the -Xmx switch, I 
> > assumed that there was an option to specify "as much as you can get 
> > from the OS" but again, no. 
> > 
> > I imagine the people working on the JVM are a little smarter than the 
> > average bear so there's probably good, non-trivial reasons for 
> > requiring -Xmx but I don't know what they are. Can anyone give some 
> > pointers on this? Also, what does the .Net CLR do? Does it impose any 
> > constraints on memory allocation? Does it suffer from poorer garbage 
> > collection or allocation performance at the expense of its strategy? 
> > 
> > Thanks, 
> > Phil 
> > 
>

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/javaposse/-/PHPoRLx7fNMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to