javaw.exe eating up my memory?
Asked Answered
K

4

5

Recently, javaw.exe processes have been taking over my computer and forcing me to exit out Eclipse and other applications due to low memory errors. Note that I am not maxing out the system at all, and am I working on some basic java programs, and I have 2-3 eclipse tabs open at a time max.

I have about 40-50 of these javaw.exe processes each take up 22K-26K of RAM, which eventually eats up 70-80% of my 8GB RAM on my machine. This is extremely frustrating as I cannot do any work like this. I was wondering if anyone else has experienced this and knows how to troubleshoot this problem?

Kingston answered 8/10, 2012 at 19:17 Comment(6)
This behavior looks like a virus to me.Whiles
May be there are some programs which are still running in the background.Tutelary
Have you been able to isolate when they are starting?Prentiss
I dont think its a virus, I have an anti virus software returning good results, and I had this problem for a couple of weeks now and I recently ran a system recovery to try to fix this, which didn't help.Kingston
It seems like they are starting when I compile and run a java program in eclipse and it is not always the case that when close the application, that the process closes as well.Kingston
There is no Help -> Performance in my Eclipse...Tephra
W
10

You probably launch the same program again and again from eclipse, and these programs never exit. Switch to the Debug perspective, and look at the Debug view. Kill all the processes that should not run anymore.

That said, 50 * 26KB is very very far from 8GB * 80%. And I doubt any Java program can be as light as 26KB.

Wheatley answered 8/10, 2012 at 19:23 Comment(6)
But I do exit these programs. However, when I go to 'Windows Task Manager' the processes don't disappear after I exit the Java programs from eclipse...Kingston
How do you exit them? Do you press the square red "Terminate" button in the Debug view? A Java program terminates when System.exit() is called. If you just close the main window of your Swing/AWT application, for example, it doesn't exit.Wheatley
Or it could be that some non-daemon threads continue to run in the background and prevent those programs from exiting.Haddock
I see, that is the root of my problem... In the past when I clicked 'x' on java applications it seemed to get rid of the process automatically, however now it is not the case. I will ue the red terminate button from now on... thank you!Kingston
Or you could fix your program and make sure System.exit is called when the frame is closed. See docs.oracle.com/javase/6/docs/api/javax/swing/…Wheatley
Either make a System.exit call when main window is closed or identify background threads that continue running and devise a way to orderly terminate them when main window is closed. When all threads have terminated, the JVM will exit.Fountain
M
2

It normally happens when you are doing multi threading. Make sure you stop all the threads which you have created by calling a thread.interrupt() for the the threads you have spawned before you end the application. That would remove javaw.exe from your Task Manager - Hope this will be helpful

Manoff answered 7/12, 2012 at 18:15 Comment(0)
P
1

If you are using JFrame, try this:

Main frame=new Main();//Main class extends JFrame.
frame.setdefaultcloseoperation(JFrame.EXIT_ON_CLOSE);
Pegpega answered 11/8, 2013 at 9:27 Comment(0)
K
0

Normally each eclipse instance should only have one javaw.exe process.. so check with a process explorer that they actually belong to eclipse and not some other background/zombie programs.

If you want to reduce javaw.exe memory, you can use Help -> Performance -> Reducy Memory now..

Note that this will reduce the used memory only of the actual eclipse's javaw.exe process..

Kind answered 8/10, 2012 at 19:22 Comment(2)
@Majid Laissi, On Eclipse Mars.1 (4.5.1), there is no Help -> Performance option too. Why do your eclipse has this option?Vitrify
yeah that was removed a long time agoKind

© 2022 - 2024 — McMap. All rights reserved.