linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* free memory usage
@ 2003-05-09 11:25 - Luis -
  2003-05-09 17:29 ` Scott Taylor
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: - Luis - @ 2003-05-09 11:25 UTC (permalink / raw)
  To: linux-admin

Hi everyone, 

I got a RH7.3 box which runs a java app, but i got the problem that the app 
didn't close the session with the server, so every day i got to reset the 
server to free the memory use by all the java sessions.  The first thing i 
try, was to use a bash script to kill all the java sessions, but i find out 
that the memory was still full, so the question is:

How can i free that memory without rebooting the server?

Thanks a lot 
-- 
Luis Valencia
------------------------
With a PC, I always felt limited
by the software available.
On Unix, I am limited only by my knowledge.
--Peter J. Schoenster



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: free memory usage
  2003-05-09 17:55 ` Glynn Clements
@ 2003-05-09 12:10   ` - Luis -
  0 siblings, 0 replies; 10+ messages in thread
From: - Luis - @ 2003-05-09 12:10 UTC (permalink / raw)
  To: Glynn Clements; +Cc: linux-admin

Thanks, let me take a closer look at the mem stat, because i was only looking 
at the info from top command, but in fact im restarting the deamon that get 
the app up, and the free mem field from 'top' is still showing a lot of 
memory used.

On Friday 09 May 2003 17:55, Glynn Clements wrote:
> - Luis - wrote:
> > I got a RH7.3 box which runs a java app, but i got the problem that the
> > app didn't close the session with the server, so every day i got to reset
> > the server to free the memory use by all the java sessions.  The first
> > thing i try, was to use a bash script to kill all the java sessions, but
> > i find out that the memory was still full, so the question is:
> >
> > How can i free that memory without rebooting the server?
>
> First, are you sure that the memory isn't being released? Or are you
> misreading the memory statistics? In the output from "free", the
> relevant numbers are those on the second row; e.g. here:
>
>              total       used       free     shared    buffers     cached
> Mem:        257572     103312     154260          0       3640      48164
> -/+ buffers/cache:      51508     206064
> Swap:       262136          0     262136
>
> the relevant number is 206064. The numbers on the first row (e.g.
> 154260 above) aren't relevant.
>
> OTOH, if the server really is running out of memory, even when the
> clients are being killed, the only solutions are to either:
>
> a) re-write the daemon which is using up all of the memory, or
> b) forcibly restart the daemon at regular intervals (you don't need to
> reboot the entire server, and doing so won't acheive anything).

-- 
Luis Valencia
------------------------
With a PC, I always felt limited
by the software available.
On Unix, I am limited only by my knowledge.
--Peter J. Schoenster



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: free memory usage
  2003-05-09 17:46 ` Mikel Bauer
@ 2003-05-09 14:58   ` - Luis -
  2003-05-09 21:29     ` Richard Nairn
  2003-05-09 22:08     ` Mikel Bauer
  0 siblings, 2 replies; 10+ messages in thread
From: - Luis - @ 2003-05-09 14:58 UTC (permalink / raw)
  To: Mikel Bauer; +Cc: linux-admin

And what about if the mem is being cached or buffered? what can i do about it? 
can i free it?

Thanks

On Friday 09 May 2003 17:46, Mikel Bauer wrote:
> Is memory still technically "full" (used), or is it cached?  Usually the
> kernel is smart enough to fix problems like that, and will free memory
> that's no longer being referenced (memory leaks really only exist if an
> app is still running, the kernel wont take away memory from a running app)
>
> I would take a look at your /proc/meminfo, and see if most of the "used"
> memory is accounted for in the cache.

-- 
Luis Valencia
------------------------
With a PC, I always felt limited
by the software available.
On Unix, I am limited only by my knowledge.
--Peter J. Schoenster



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: free memory usage
  2003-05-09 11:25 - Luis -
@ 2003-05-09 17:29 ` Scott Taylor
  2003-05-09 17:46 ` Mikel Bauer
  2003-05-09 17:55 ` Glynn Clements
  2 siblings, 0 replies; 10+ messages in thread
From: Scott Taylor @ 2003-05-09 17:29 UTC (permalink / raw)
  To: linux-admin

At 04:25 AM 05/09/03, - Luis - wrote:
>Hi everyone,
>
>I got a RH7.3 box which runs a java app, but i got the problem that the app
>didn't close the session with the server, so every day i got to reset the
>server to free the memory use by all the java sessions.  The first thing i
>try, was to use a bash script to kill all the java sessions, but i find out
>that the memory was still full, so the question is:
>
>How can i free that memory without rebooting the server?


Fix the Java App.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: free memory usage
  2003-05-09 11:25 - Luis -
  2003-05-09 17:29 ` Scott Taylor
@ 2003-05-09 17:46 ` Mikel Bauer
  2003-05-09 14:58   ` - Luis -
  2003-05-09 17:55 ` Glynn Clements
  2 siblings, 1 reply; 10+ messages in thread
From: Mikel Bauer @ 2003-05-09 17:46 UTC (permalink / raw)
  To: - Luis -; +Cc: linux-admin

Is memory still technically "full" (used), or is it cached?  Usually the 
kernel is smart enough to fix problems like that, and will free memory 
that's no longer being referenced (memory leaks really only exist if an 
app is still running, the kernel wont take away memory from a running app)

I would take a look at your /proc/meminfo, and see if most of the "used" 
memory is accounted for in the cache.

-- 
Mikel Bauer
mikel@bridgeband.net

- Luis - wrote:
> Hi everyone, 
> 
> I got a RH7.3 box which runs a java app, but i got the problem that the app 
> didn't close the session with the server, so every day i got to reset the 
> server to free the memory use by all the java sessions.  The first thing i 
> try, was to use a bash script to kill all the java sessions, but i find out 
> that the memory was still full, so the question is:
> 
> How can i free that memory without rebooting the server?
> 
> Thanks a lot 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: free memory usage
  2003-05-09 11:25 - Luis -
  2003-05-09 17:29 ` Scott Taylor
  2003-05-09 17:46 ` Mikel Bauer
@ 2003-05-09 17:55 ` Glynn Clements
  2003-05-09 12:10   ` - Luis -
  2 siblings, 1 reply; 10+ messages in thread
From: Glynn Clements @ 2003-05-09 17:55 UTC (permalink / raw)
  To: - Luis -; +Cc: linux-admin


- Luis - wrote:

> I got a RH7.3 box which runs a java app, but i got the problem that the app 
> didn't close the session with the server, so every day i got to reset the 
> server to free the memory use by all the java sessions.  The first thing i 
> try, was to use a bash script to kill all the java sessions, but i find out 
> that the memory was still full, so the question is:
> 
> How can i free that memory without rebooting the server?

First, are you sure that the memory isn't being released? Or are you
misreading the memory statistics? In the output from "free", the
relevant numbers are those on the second row; e.g. here:

             total       used       free     shared    buffers     cached
Mem:        257572     103312     154260          0       3640      48164
-/+ buffers/cache:      51508     206064 
Swap:       262136          0     262136

the relevant number is 206064. The numbers on the first row (e.g. 
154260 above) aren't relevant.

OTOH, if the server really is running out of memory, even when the
clients are being killed, the only solutions are to either:

a) re-write the daemon which is using up all of the memory, or
b) forcibly restart the daemon at regular intervals (you don't need to
reboot the entire server, and doing so won't acheive anything).

-- 
Glynn Clements <glynn.clements@virgin.net>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: free memory usage
  2003-05-09 14:58   ` - Luis -
@ 2003-05-09 21:29     ` Richard Nairn
  2003-05-09 22:08     ` Mikel Bauer
  1 sibling, 0 replies; 10+ messages in thread
From: Richard Nairn @ 2003-05-09 21:29 UTC (permalink / raw)
  To: - Luis -; +Cc: Mikel Bauer, linux-admin

There is no reason to do anything about memory being used by cached or
buffered. That is automatic, and it speeds up your system. 

As far as memory leaks go, if you shut down and restart the program, the
memory will be recovered. Otherwise find the problem and fix it. 

On Fri, May 09, 2003 at 02:58:56PM +0000, - Luis - wrote:
> And what about if the mem is being cached or buffered? what can i do about it? 
> can i free it?
> 
> Thanks
> 
> On Friday 09 May 2003 17:46, Mikel Bauer wrote:
> > Is memory still technically "full" (used), or is it cached?  Usually the
> > kernel is smart enough to fix problems like that, and will free memory
> > that's no longer being referenced (memory leaks really only exist if an
> > app is still running, the kernel wont take away memory from a running app)
> >
> > I would take a look at your /proc/meminfo, and see if most of the "used"
> > memory is accounted for in the cache.
> 
> -- 
> Luis Valencia
> ------------------------
> With a PC, I always felt limited
> by the software available.
> On Unix, I am limited only by my knowledge.
> --Peter J. Schoenster
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
---end quoted text---

-- 
|       Richard Nairn          Specializing in Linux
|     Nairn Consulting         Web / Database Solutions
|        Calgary, AB           
| Richard@NairnConsulting.ca

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: free memory usage
  2003-05-09 14:58   ` - Luis -
  2003-05-09 21:29     ` Richard Nairn
@ 2003-05-09 22:08     ` Mikel Bauer
  1 sibling, 0 replies; 10+ messages in thread
From: Mikel Bauer @ 2003-05-09 22:08 UTC (permalink / raw)
  To: - Luis -; +Cc: linux-admin

Memory that is buffered or cached is not the same as being used.  It is 
memory that was used before, freed, but with the possibility of being 
used again so as to speed up information retrieval.  This memory is 
available to whatever needs it.  There probably isn't a server in 
existance that doesn't cache a fair bit of memory (unless it was never 
used).

- Luis - wrote:
> And what about if the mem is being cached or buffered? what can i do about it? 
> can i free it?
> 
> Thanks
> 
> On Friday 09 May 2003 17:46, Mikel Bauer wrote:
> 
>>Is memory still technically "full" (used), or is it cached?  Usually the
>>kernel is smart enough to fix problems like that, and will free memory
>>that's no longer being referenced (memory leaks really only exist if an
>>app is still running, the kernel wont take away memory from a running app)
>>
>>I would take a look at your /proc/meminfo, and see if most of the "used"
>>memory is accounted for in the cache.
> 
> 

-- 
Mikel Bauer


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: free memory usage
@ 2003-05-10  3:39 jbrown105
  2003-05-10 11:15 ` Glynn Clements
  0 siblings, 1 reply; 10+ messages in thread
From: jbrown105 @ 2003-05-10  3:39 UTC (permalink / raw)
  To: unix; +Cc: linux-admin

On Fri, May 09, 2003 at 11:25:31AM +0000, - Luis - wrote:
> Hi everyone, 
> 
> I got a RH7.3 box which runs a java app, but i got the problem that the app 
> didn't close the session with the server, so every day i got to reset the 
> server to free the memory use by all the java sessions.  The first thing i 
> try, was to use a bash script to kill all the java sessions, but i find out 
> that the memory was still full, so the question is:
> 
> How can i free that memory without rebooting the server?
> 
> Thanks a lot 
> -- 
> Luis Valencia

If 'kill -SIGTERM' doesnt work, then 'kill -SIGKILL' should.

On getting a sigkill the app is required to quit and free all of its
memory (as well as close files etc).

> ------------------------
> With a PC, I always felt limited
> by the software available.
> On Unix, I am limited only by my knowledge.
> --Peter J. Schoenster
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
 /"\  ASCII ribbon              | http://www.geocities.com/jbrown1050/
 \ /  campain against           | Linux User:190064
  X   HTML in e-mail and        | Linux Machine:84163
 /*\  news, and unneeded MIME   | 
----------------------------------------------------------------------
You too can spend five years in prison; just distribute this program
once US Senator Hollings's CBDTPA bill is passed into law:
perl -e 'while(<>) { print;}'


-- 
http://www.fastmail.fm - Access your email from home and the web

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: free memory usage
  2003-05-10  3:39 free memory usage jbrown105
@ 2003-05-10 11:15 ` Glynn Clements
  0 siblings, 0 replies; 10+ messages in thread
From: Glynn Clements @ 2003-05-10 11:15 UTC (permalink / raw)
  To: jbrown105; +Cc: unix, linux-admin


jbrown105@speedymail.org wrote:

> > I got a RH7.3 box which runs a java app, but i got the problem that the app 
> > didn't close the session with the server, so every day i got to reset the 
> > server to free the memory use by all the java sessions.  The first thing i 
> > try, was to use a bash script to kill all the java sessions, but i find out 
> > that the memory was still full, so the question is:
> > 
> > How can i free that memory without rebooting the server?
> 
> If 'kill -SIGTERM' doesnt work, then 'kill -SIGKILL' should.
> 
> On getting a sigkill the app is required to quit and free all of its
> memory (as well as close files etc).

More accurately: on receiving SIGKILL, the process will be forcibly
terminated, and all of its resources will be released. This doesn't
require any cooperation from the program.

-- 
Glynn Clements <glynn.clements@virgin.net>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-05-10 11:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-10  3:39 free memory usage jbrown105
2003-05-10 11:15 ` Glynn Clements
  -- strict thread matches above, loose matches on Subject: below --
2003-05-09 11:25 - Luis -
2003-05-09 17:29 ` Scott Taylor
2003-05-09 17:46 ` Mikel Bauer
2003-05-09 14:58   ` - Luis -
2003-05-09 21:29     ` Richard Nairn
2003-05-09 22:08     ` Mikel Bauer
2003-05-09 17:55 ` Glynn Clements
2003-05-09 12:10   ` - Luis -

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).