Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java in Console. Not releasing RAM

Status
Not open for further replies.

LucL

Programmer
Jan 23, 2006
117
US
Hey Guys,

I've got a java program that runs in the console (Linux redhat). If I let it run and finish, it seems to clean up ram OK, however if I CTRL+C it and force stop the execution, the ram never frees up (not even an hour or two later or when I launch another copy of it).

Both the physical ram and the cache seem to be affected. the swap is never used, but comes close.

Any ideas on how to force clean the ram?

Thanks,
Luc
 
Strange. Is the process still up? If not, looks like Linux doesn't kill its processes ok, and that's very improbable. Look for a process called java (ps -aux | grep java).

Cheers,
Dian
 
I guess what happens is that redhat waits for the memory buffer to fill up before it performs a big cleanup.

So, when I force kill the java program, its data remains in memory for some reason, but eventually the memory is reclaimed when another program eats up all of the memory or whenever redhat feels like it's time to reclaim it (1hr+ later).

Not sure if this is normal, but since the RAM space appears to be accessible, just not properly showing up in free -m, the problem is solved.

Thanks for your help guys.
Luc
 
Ah - it's just the amount of free RAM, but no process running anymore.

That's normal behaviour for linux, and hasn't to do anything with linux.
If you start your program again, most of it can be used from the cache. Linux uses as much RAM as available to cache.

Try it with some slow starting program.
The first start takes - let's say 10s.
If you terminate it, and restart it, it will come up in 3s (for example).

To clean the RAM, you have to power off :) .

don't visit my homepage:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top