[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-03 Thread blake
We've had pretty good luck monitoring JVM usage with JMX. We can certainly do everything that sherod@ claims is done in the real world. On the other hand, one thing that we cannot discover, that I *really* wish we could, is when the GC is about to run a major collection. No matter what we do,

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-03 Thread clint.foster
I agree with Phil. All VM's should allow memory usage to grow without bound. Someone should alert VMWare to this great idea too. While we're fixing shorted-sighted design problems in Java, let's take care of some other things too: - I should be able to access arbitrary memory locations with

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-02 Thread John Nilsson
There was a discussion about this in the Linux community a few years ago and some kernel developer claimed to having good results from designating a RAM-drive to be swap. Maybe it's a good middle road between keeping the functionality that now depends on swap and not using disk... BR, John On

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-02 Thread Christian Catchpole
if the RAM drive itself needed to swap, we might not need the large hadron collider. sounds like black hole territory :) On Jan 2, 8:10 pm, John Nilsson j...@milsson.nu wrote: There was a discussion about this in the Linux community a few years ago and some kernel developer claimed to having

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-02 Thread Ruben Reusser
yes, I meant heap size - -Xmx is limiting the heap size but not the mmapped memory - to me it becomes a discussion about how many objects a java app can have at the same time and at what count of objects you might want to reconsider your design approach as well as do we really need to store

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-02 Thread Casper Bang
Actually it can work nicely. I use TMPFS for my dev work, it automatically uses available/specified amount of RAM but starts to use swap if required. By my experience, that approach speeds up Ant and Maven builds by order of magnitudes - makes NetBeans fly. /Casper On Jan 2, 11:52 am,

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-02 Thread Alexey Zinger
: From: sherod steven.he...@gmail.com Subject: [The Java Posse] Re: why doesn't java allocate memory as needed (max heap size) To: The Java Posse javaposse@googlegroups.com Date: Wednesday, December 31, 2008, 10:00 PM It's things like this that gives Java such a low reputation in some

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-02 Thread Christian Catchpole
Yeah, I didn't meant to suggest it wouldn't work. I'm just keeping up my quota of non-serious posts. :) On Jan 3, 1:15 am, Casper Bang casper.b...@gmail.com wrote: Actually it can work nicely. --~--~-~--~~~---~--~~ You received this message because you are

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-01 Thread Reinier Zwitserloot
Sherod, your rant doesn't really work: There is simple no one right way to do memory limits. If you allow an app to eat up as much as it would need, then there are plenty of situations where THAT was clearly the wrong thing to do, particularly on the client, which, contrary to some insinuations

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-01 Thread kirk
A recap of issues with eating as much memory as you want: FACT A: OSes manage virtual memory and make it relatively hard for userland apps to meddle and/or inspect this. FACT B: There's no way for the JVM to see any difference between an app leaking memory and an app that has a

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-01 Thread kirk
NIO virtual memory mapped is outside of the VM memory. Do you mean Java heap? 'cos, mmapeed memory is part of the process space though not Java heap if that is what you meant. Regards, Kirk --~--~-~--~~~---~--~~ You received this message because you are

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-01 Thread Christian Catchpole
I always thought it weird that java was originally targetted for embedded. These don't typically use compacting collectors - combine this with limited memory and you are asking for fragmentation and out of memory conditions based on the dyamics of the runtime conditions. Nothing you can

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-01 Thread Reinier Zwitserloot
It's not perfect. But its pretty cool! false positive: Let's say you have a very long running open connection on a web server (comet or some such) and it's been almost a day since the last update or access. Its occupying memory for a purpose, and assuming the OS is still tracking the connection

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-01 Thread Reinier Zwitserloot
Kirk: Last time I owned a windows box (I admit, that was quite a while ago, but it did have XP SP2, which as far as everyone is concerned is the 'latest' version of windows still, I believe), when I tried to turn swap off a whole host of apps stopped working. I then configured swap to be 50MB in

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2009-01-01 Thread kirk
Reinier Zwitserloot wrote: Kirk: Last time I owned a windows box (I admit, that was quite a while ago, but it did have XP SP2, which as far as everyone is concerned is the 'latest' version of windows still, I believe), when I tried to turn swap off a whole host of apps stopped working. I

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2008-12-31 Thread Reinier Zwitserloot
I'm not sure, but I *think* this is roughly how it works: Java doesn't just allocate the entire 'max heap size' when it starts up, instead it will allocate up to that amount if needed. Whenever java runs out of memory, it'll aggressively garbage collect first. You'll only get OOME when, after a

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2008-12-31 Thread phil.swen...@gmail.com
Your test app is going to behave differently than your production app. So you may not know how much memory you will use until you launch it. And then when it crashes, you make the adjustment. But even if you are right, it's to keep your whole server from failing why not have an option to

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2008-12-31 Thread Jason Waring
Hi, If I remember rightly, the max heap size was 16Mb during the 1.0.x days of Java. The rationale I heard/read was to set a low base memory, so application would be designed to run on most 'modern' computers. Of course, back then, there was a lot of discussion about using Java for Applet and

[The Java Posse] Re: why doesn't java allocate memory as needed (max heap size)

2008-12-31 Thread sherod
It's things like this that gives Java such a low reputation in some operational areas. This is how the 'real world' should work: System monitoring software watches memory usage on a process / machine. It alerts operational staff when it moved beyond acceptable bounds Investigation starts -