Re: Waking up sleeping Java applications

From: Chris Smith (cdsmith_at_twu.net)
Date: 12/05/03


Date: Fri, 5 Dec 2003 07:56:36 -0700

Ben Jessel wrote:
> I would hazard a guess that windows always pages it out of memory when
> you minimize it.

That seems to be common knowledge... At the very least, it
substantially reduces the working set size for the process, causing much
of the process to be swapped out to disk.

> However, the reason that C++ ms programs etc dont
> have this problem is that they don't have virtual machine code and
> state to restore.

I doubt that's really an issue, actually. The larger virtual machine
subsystems, like the JIT compiler, are unlikely to be needed when
returning to a long-running Java application. As I just said in another
response, I suspect it's a degenerate relationship between garbage
collection and Windows memory management.

Another artifact of Windows memory management is that instead of using a
straight LRU policy for paging, Windows tries to be fair; it keeps track
of a "working set size" for any given application, and only very
reluctantly adds memory to that working set size if the application
establishes a pattern of swapping. That's a really bad idea when an
application is running a large garbage collection and is mostly swapped
out. If a substantial portion of memory accesses by the garbage
collector are paging, then gc can take 50 to 100 times longer than it
would if the VM subsystem would cooperate. I suspect the VM subsystem
in Windows is optimized around applications with manual memory
management, and no one ever considered how to avoid a pathological case
with garbage collection.

Nevertheless, I've still never actually seen the described symptoms.

> Also, could it be that the classloader refreshes all the classes once
> an app becomes re-activated?

No. That's definitely not the case.

> I think roedy even suggests himself on his site an idea for a project
> where Java dll's are held in memory to enable faster app startup.

Indeed. Back when I still had some time, a few others and I fleshed out
the idea, and documented our plans at http://chives.sunsite.dk/. Then,
of course, we all got too busy before we could complete the test
implementation. Word on the street is that Sun and Apple are
collaborating on a similar approach, but there's no committed release
schedule.

-- 
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation


Relevant Pages

  • RE: Virtual memory
    ... You can configure virtual memory in windows xp and thereby improve the ... How to set performance options in Windows XP ... if you have background programs such as printing or disk ... It is also known as the paging file. ...
    (microsoft.public.windowsxp.perform_maintain)
  • [NT] NNTP Service in Windows Contains Memory Leak
    ... NNTP Service in Windows Contains Memory Leak ... An affected server could be restored to normal service by ...
    (Securiteam)
  • Re: Physical Memory
    ... These Windows services are started: ... Memory optimizers/defragers are nothing more than snake ... These optimizers work by making demands on the Windows Memory Manager ... The funny thing about all of this nonsense is that the snake oil memory ...
    (microsoft.public.windowsxp.general)
  • Re: How hard is socket programming?
    ... finds the page which still happens to be in memory and ... paged out on Windows 7 with 8.0 GB RAM. ... As far as I can tell FastCGI is good here ... one that has been established by long practice (the ...
    (microsoft.public.vc.mfc)
  • Re: Slow performance
    ... computer has two memory slots so to achieve 1 gb you need to install 2 x ... own set up consists of AVG 8 Anti-Virus, Spybot S& D, Windows Defender ... of programme is generally not recommended in these newsgroups. ... My disk drive is pretty full right now, mainly due to fact that I just ...
    (microsoft.public.windowsxp.perform_maintain)