Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Windows Swapping out Java  (Read 4497 times)
0 Members and 1 Guest are viewing this topic.
Offline dranonymous

Junior Member




Hoping to become a Java Titan someday!


« Posted 2004-07-20 01:15:58 »

I've noticed that windows does an annoying thing to java apps.  At least thats my perspective.

If you run something like eclipse and are using it, you can check the process manager.  It will probably show at least 20Meg or so.

If you minimize eclipse or any java apps, the memory drops down after awhile.  My assumption is that much of the app is getting swapped out to the hard drive.

When you then go to use the app and maximize it again, you can watch the memory footprint jump as it puts everything back into memory.  This ends up taking about 30 seconds or so, before the once responsive java app becomes usuable again.

Linux doesn't appear to suffer from this.  Nor do executables that are binaries.

Is there some way to make windows stop this?  What about some command line args for the jvm?
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #1 - Posted 2004-07-20 06:10:53 »

seen that before...

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Malohkan

Senior Member




while (true) System.out.println("WOO!!!!");


« Reply #2 - Posted 2004-07-20 14:56:49 »

me too.  If I have Eclipse running, and leave my computer for a couple hours and come back and pull back up the window, it takes a long time for it to be usable.  My computer clicks like mad for like 5 straight minutes doing seemingly nothing until I can finally type some characters into Eclipse.  Then after a minute it'll start all over again taking another 5 minutes to give me back control of my keyboard.  Then usually after that it's ready to be used again.

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Azeem Jiva

Junior Member




Java VM Engineer, Sun Microsystems


« Reply #3 - Posted 2004-07-20 16:42:39 »

Quote
me too.  If I have Eclipse running, and leave my computer for a couple hours and come back and pull back up the window, it takes a long time for it to be usable.  My computer clicks like mad for like 5 straight minutes doing seemingly nothing until I can finally type some characters into Eclipse.  Then after a minute it'll start all over again taking another 5 minutes to give me back control of my keyboard.  Then usually after that it's ready to be used again.



The reason this happens is described here:
http://support.microsoft.com/default.aspx?scid=kb;en-us;293215                  

This is true for all apps, not just Java ones
Offline dranonymous

Junior Member




Hoping to become a Java Titan someday!


« Reply #4 - Posted 2004-07-20 17:53:25 »

I don't think its completely true for all apps.  Netscape crawls like a pig when you come back and maximize it.  Explorer, interestingly, doesn't seem to.

One trick, which is already been round about mentioned is to simply not minimize your apps.  It gets annoying trying to move around a bit, but otherwise works.

I've often wondered about virtual memory in modern computers, especially windows.  When I was married to my Amiga, it never had a virtual memory.  What you physically had is what you used.  I still haven't ever figured out the REAL benefit of virtual memory.  If I have a Gig of ram and thats not enough to keep everything in memory, then something seems out of whack.  And why in heck do I need a default swap size thats just as large as my physical ram?  Its looks like something just asking for problems.

Any idea on how to mess with the windows settings to optimize things better?

Herkules, thanks for the reference.  I had missed that one!
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2004-07-20 18:26:38 »

Virtual memory is an anachronism. Once upon a time RAM was rare and expensive. Now it's so cheap I can have a gig in a laptop, which is twice the size of the physical RAM plus the swap file on my last desktop.

So: ajiva, is there a possibility you might be able to add some flags to the VM so that we can pin a certain amount in the working set rather than let Windows swap it out?

Cas Smiley

Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #6 - Posted 2004-07-20 18:37:46 »

Quote
I don't think its completely true for all apps.  Netscape crawls like a pig when you come back and maximize it.  Explorer, interestingly, doesn't seem to.


...it's explained in the KB article.

re: virtual RAM, I'm firmly with Cas. I've disabled VM on windows since 1999. Unfortunately, some windows apps are **** stupidly coded to REQUIRE VM, including Unreal Tournament (sob) and will simply crash (pseudo-randomly) if they can't find enough. Great.

Also, lots of crap DX games (and some flash stuff IIRC) crashes when windows automatically increases the swap space (despite you not needing it to nor wanting it to) and pops up a dialog to tell you. IIRC this is simply because the programmers were too lazy or ignorant to code the handlers for losing the accelerated RAM and needing to repopulate. If you live in the UK then Golden Grahams had a promo giving away CD's with an Umbo-sponsored football game that has this problem. But then it also has a spectacular memory leak, so I don't think much of the muppets who wrote it and claim to be a pro studio Smiley (yours truly had to support a family member trying to run it and discovered this calamity of incompetence Sad).

malloc will be first against the wall when the revolution comes...
Offline dranonymous

Junior Member




Hoping to become a Java Titan someday!


« Reply #7 - Posted 2004-07-20 20:42:12 »

What I meant by not all apps doing it, is that MS is pig and they probably have theirs coded so that it won't swap out.  They use the workaround in the article you see.  Wink

Anyway, I just disabled all my VM and voila!  I have a brand new machine.  I doubt that we can convince the users of our programs to always do the same, but its worth a try.

Now I just need to do this on my machine at home.

I feel like its christmas.  Smiley
Offline Mark Thornton

Senior Member





« Reply #8 - Posted 2004-07-20 21:02:12 »

Quote

So: ajiva, is there a possibility you might be able to add some flags to the VM so that we can pin a certain amount in the working set rather than let Windows swap it out?
Cas Smiley

A better approach would be to use the alternative minimise mechanism which doesn't trim the working set; possibly selected by a command line switch. Also the garbage collector could request an increase in working set size before doing a full collection.
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #9 - Posted 2004-07-20 21:33:51 »

Quote
Also, lots of crap DX games

Sod crap games, the majority of DX games I've played seem to suffer from this, regardless of how good they actually are. The ones that don't have other weirdness going on that plays havok when you alt-tab or switch away in some form.

It does seem to have gotten better in the last year or so though, but I still cringe when I have to minimise any fullscreen game, knowing full well that the odds aren't in my favour...

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #10 - Posted 2004-07-20 22:17:39 »

Hm, actually now that you mention it, I suddenly realise you are quite right about DX based games. I've just gone and tried a few and they all exhibit awful, awful behaviour with alt-tab.

Cas Smiley

Offline elias

Senior Member





« Reply #11 - Posted 2004-07-21 14:56:22 »

Heh, this is where OpenGL really shines: The designers knew that a condition occurring very rare (loosing buffers) should be avoided at all costs. So OpenGL preserves textures and other resources created by the application. The only exception (that I know of is) is memory mapped VBOs.

- elias

Offline ivanm

Senior Newbie




I love YaBB 1G - SP1!


« Reply #12 - Posted 2004-07-22 20:06:42 »

It is very easy to modify SWT of Eclipse and see if it works.. You only need to touch one file: org/eclipse/swt/widgets/Decorations.java and add 5 lines of code. No JNI required. If anyone is interested I can email the modified \eclipse\plugins\org.eclipse.swt.win32_3.0.0\ws\swt.jar file. If only I didn't have 2gigs of RAM at work..
Offline Raghar

Junior Member




Ue ni taete 'ru hitomi ni kono mi wa dou utsuru


« Reply #13 - Posted 2004-07-22 22:26:58 »

To the swap file disablers. Congratulations on this approach, it's really bright. O_O
My current swap file is filled to 221 MB. My memory is 128+64 MB. Now lets consider hypothetical situation, what would happen if I didn't have any swap file.

Cas it was very funny. This also means that you'd be unable to run my current game, nor to run my original tester (I trimmed it down a little because it throwed an out of memory error when tested on a computer with disabled swap file.).

My current specs are: 196 MB RAM 133. 1.4 GB swap on separate logical drive, non fragmented, and with unchanging size. (Processor scheduling - services on the background. Memory usage - programs.) I didn't have problem with Eclipse, or JEdit. Well I had a little problem when explorer for some reason attempted to discover size of 410 files by reading them into the memory. Swap was filled up to 712 MB and it swapped horribly, but I was able to use jEdit and other programs without really hard problems.

So before disabling the swap file try to use cacheman, and be sure you HD has enabled block read mode and your swap file is unfragmented.  
Actually play a little with cacheman settings if you are on windoze. On Linux, look into configuration files and enable read ahead, and UDMA.
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #14 - Posted 2004-07-22 22:47:28 »

Quote
To the swap file disablers. Congratulations on this approach, it's really bright. O_O


Is that sarcastic? (sorry, I'm not sure).

Quote

This also means that you'd be unable to run my current game, nor to run my original tester (I trimmed it down a little because it throwed an out of memory error when tested on a computer with disabled swap file.).


Why would people be unable to run your game? Are you doing the same as UT and have some bizarre dependency upon swap space?

Quote

On Linux, look into configuration files and enable read ahead, and UDMA.


IIRC on linux you just do "swapoff -a" Smiley. Works a charm. The only difference I've noticed compared to windows is that apps only crash this way if they *genuinely* run out of memory...

Oh, and my HD thrashes considerably less often, which is very nice, (especially if you have a laptop which is otherwise aggressive at powering down the HD).

malloc will be first against the wall when the revolution comes...
Offline Raghar

Junior Member




Ue ni taete 'ru hitomi ni kono mi wa dou utsuru


« Reply #15 - Posted 2004-07-24 01:51:10 »

Yes a little sarkasm in the morning.

Basically it's the same as with the Alien Flux. I think that windows should know much beter than programmer what they should swap and what not. And my game is a little more memory demanding.  Basically 2 GB of memory is nice to have. However 256 - 512 and swap is affordable, and performance is down just by 1/5. 4/5 speed of high memory system is very nice and I don't need to swap to and from GFX card just to avoid out of memory error.

Well laptops are different beasts, especially if they are disconected from permanent energy source. (Plutonium generator do wonders however.) ^_^

Offline Mark Thornton

Senior Member





« Reply #16 - Posted 2004-07-24 08:43:59 »

Quote
(Plutonium generator do wonders however.)


I'm not having one of those on my lap!
Offline dranonymous

Junior Member




Hoping to become a Java Titan someday!


« Reply #17 - Posted 2004-07-25 16:00:44 »

Raghar - Not really sure why you'd be so against disabling the swap.  It works great and besides, I have zero desire to go mucking about with hard drive settings, cache setup, and lots of other gunk, if I can do the same thing with just a few clicks.

I highly doubt windows knows better than I do about when to swap.  If they did, they would have another setting which says, don't swap unless you have used x% of real memory.  IMHO.  Suppose I was rendering some huge video and decided to minimize the window, so I could check my email.  Stupid machine would go grinding my render process to a halt.

The only dif I can see between swapping in a laptop versus a desktop is that the laptop should swap even less to the HD.  It sucks extra power to keep transfering stuff back and forth.  Surely keeping stuff in ram uses less energy than powering the HD to transfer the data around.

My thoughts anyway!  No VRam and loving it!
Offline Raghar

Junior Member




Ue ni taete 'ru hitomi ni kono mi wa dou utsuru


« Reply #18 - Posted 2004-07-26 19:27:35 »

[rant]
Zero desire to go with setuping your computer? It's sounds like "I have zero desire to play with the antivirus.". I think that 2 days per month are part of user responsibilities. Checking CPU temperature, HD cleaning, virus scanning, looking for trojans, and backup are also part of responsibilities when you are using computer.  ( I found, just recently, 700 MB backup of FF CD that I completely forgot to delete.) [/rant]
Basically I'm against disallowing of the swap. I have more bad experiences with it, and I don't remember on any nice experience.
Programs crashing in the worst moment. Programs that refused to run just because they needed a few kB more memory... It doesn't mean I wouldn't recommend to use a some kind of fast Flash drive to do actual swapping. It might work great. If you'd have such beast you could consider to use it for your Windows/temp directory as well. 1GB for swap 1GB for virtual temp directory.  
Actually it might be very interesting if you have 64 bit processor, 4 GB RAM, and 12 GB Flash drive. (Or if your OS has a virtual 64 bit processor support.)

Quote
Suppose I was rendering some huge video and decided to minimize the window, so I could check my email.  Stupid machine would go grinding my render process to a halt.

Did it actually happen? Pretty weird if so. I used Virtdub with enlarged buffers, and lots of other programs as well. It worked well even after minimalisation.
Of course if you used Maya or GMax they are entirely different beasts.

Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #19 - Posted 2004-07-26 20:01:48 »

Quote

Basically I'm against disallowing of the swap. I have more bad experiences with it, and I don't remember on any nice experience.


i.e. like me you've encountered badly-written crud that throws a wobbly if there's no swap space.

That doesn't change the fact that:
- you don't want swap
- you don't need swap
- you shouldn't be using swap

it just means that some of us are forced to have it anyway until we can upgrade to software that was better written Sad.

Quote

Programs that refused to run just because they needed a few kB more memory


No-one's suggesting you disable swap if you have too little RAM. e.g. I could go and replace the 0.75Gb of RAM in my windows machine with 32Mb and then of course I need swap just to run windows + MS Word...doesn't change the fact that the typical PC these days has 0.5-1Gb RAM (unless you bought a cheap-ass thing and didn't bother to shell out $50 for a RAM upgrade).

malloc will be first against the wall when the revolution comes...
Offline Mark Thornton

Senior Member





« Reply #20 - Posted 2004-07-26 20:23:44 »

Of course if you need 2 or more GB of RAM life is a bit more expensive. Then you probably have to use the more expensive and usually slower 1GB RAM modules. I only need this sort of space occasionally, so swapping is appropriate.
Offline jherber

Junior Member




Java games rock!


« Reply #21 - Posted 2004-08-29 19:27:28 »

The big difference between a native application swapping out and a java application swapping out, is that java also swaps out the whole VM with the application.   so, if you are trying to accomdate the "look and feel" of a platform, obviously waiting considerably more time for a java application to swap the VM (which should be thought of as system level code in many circumstances) and application back in doesn't cut it (at least on winbloze.)  at a minimum, i'd love to see the VM implementors provide some runtime switches that allow the deployer to mark pages used by the VM as non-pageable.  

swap free on my notebook and laughing at swappers since 2000 :>
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #22 - Posted 2004-08-30 01:24:38 »

Actually the really irritating bit is that often a large part of what is swapped out and then back in is garbage.  Since swapping is such a slow operation it would be great to somehow interact with the collector to GC and possibly reduce the allocated heap before deciding to swap.  But the implementations of virtual memory are too low level for that to work.

Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #23 - Posted 2004-09-01 09:33:55 »

Garbage collection and swapfiles are a mingling of two completely incompatible concepts. A bit like using virtual memory for disk cacheing - pointless. If you're going to use garbage collection you need to be pretty sure that the heap won't get swapped out or it is inevitable that performance will be absolutely hopeless next to a native application.

I don't think the VM being swapped out is such a big deal but it makes sound sense to put it into a nonpaged area, or even in the kernel nonpaged area.

Cas Smiley

Offline dranonymous

Junior Member




Hoping to become a Java Titan someday!


« Reply #24 - Posted 2004-09-01 13:07:56 »

I'm still swap free at home and at work.  Smiley

I spoke with a friend here at work and he turned his off.  Later he turned it back on, since he was running out of ram often.  He's the type of user who runs so many apps at the same time, you can barely click between the app buttons on the task bar, as there so small.  Smiley  For him, he agreed that not using the swap was faster, but he was willing to 'bear the pain' of having his programs swap in and out, rather than stop running 500 apps at the same time.

I wonder why MS doesn't just make their swap usage more agressive, by starting with a much smaller swap size and only increasing it when physical ram is at say 75% usage.  At least then it would make a bit more sense.  IMHO.

Dr. A>
Offline Malohkan

Senior Member




while (true) System.out.println("WOO!!!!");


« Reply #25 - Posted 2004-09-01 13:30:59 »

I agree.  I tried disabling swap to circumvent the slowness, and all I got was OutOfMemory errors Wink  512mb of ram just isn't enough anymore  Grin

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (37 views)
2014-07-24 01:59:36

Riven (38 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23

MustardPeter (44 views)
2014-07-16 23:30:00

Cero (60 views)
2014-07-16 00:42:17

Riven (57 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!