On Aug 5, 2007, at 4:31 AM, Joel Uckelman wrote: > Thus spake "Rodney Kinney": >>> I suppose that one can, effectively, do this by careful >>> specification >>> of the minimum and maximum sizes. I'm not sure what the limits of >>> the JVM are for memory, but something like a minimum of 32 or 64 MB >>> and a maximum of 2 or 4 GB should do it. >> >> >> I always figured that if you tell Java it can use more memory than >> the >> system actually has, Java will crash hard when it tries to grab >> memory that >> isn't there, as opposed to the fairly graceful failure/error- >> dialog you get >> now. That's the reason not to just bump the allocation to 4GB. >> However, I >> don't actually know that this is the case. If we can establish >> that it's >> safe to, say, give 2GB to Java on a system with 512MB RAM, then >> I'll happily >> bump up the default allocation. >> >> rk >> > > I think I know what would happen on my Linux system: The real limit > is the > amount of RAM plus swap. E.g., my desktop has 512MB RAM and 1GB of > swap. > If Java allocated more than 512MB of memory, some of it would > necessarily > be swap and that would likely result in a bit of thrashing. It > would still > work, for some value of "work", but it wouldn't work well (I'm > guessing).
Actually, on a Unix-based system like Linux or Mac OS X, this shouldn't be a problem. The operating systems were initially designed to allow running with a much larger virtual memory space than physical. The paging mechanism is quite robust and the performance is also reasonable. Windows doesn't do quite as well with this, but I'm not really up on how much this has improved with time. I think NT started getting this to work better, so XP and maybe Vista work better in this regard. > > Whether it's safe depends both on how much swap there is and how much > memory is already allocated when VASSAL starts. Well, I guess the real issue boils down to how much swap space is available. If available swap space gets exhausted, then you will get an out of memory crash of that particular application, but there isn't really anything you can do if you run a module that requires more memory than you have. It does seem that 2GB is about the upper limit. > > What if we set the maximum memory allocation to some fraction of > the user's > total RAM, say 0.5? (This happens to be what I do in practice.) I tend to use a much higher ratio. I will usually go up to 1.0x RAM or sometimes even higher. I usually like to give Vassal 1GB, even on my slower, 768MB machine. It doesn't seem to be a real problem.[*] But then again, I run OS X, and usually have swap space that is several times the size of my RAM. I've seen my laptop running with a virtual memory allocation of over 10GB with only 1GB or RAM. With a reasonable virtual memory implementation from the operating system, this should work. It is exactly what virtual memory systems were built to do. It will run slower than if everything fits in RAM, but things should still be fairly reasonable, since most objects won't be in active use at the same time. Of course, the real solution is to try to go away from huge memory footprints for the graphics. The SVG work is a nice step in this direction. -Tom. [*] IIRC Java uses a copying garbage collector, which means that the heap memory in use is at most half of the memory allocation, to make sure there is enough room to copy the live data over when garbage collection is triggered. That means that as long as additional memory isn't being allocated by Vassal, half of the allocated space can be on disk without any performance penalty. > > -- > J. > > > > Yahoo! Groups Links > > >
