Flush swap manually?

Flush swap manually?

Post by oak » Fri, 12 Feb 1999 04:00:00



     Anyone know how I can manually flush swap?
     I know people say that the system is smart and will do it on it's
own, but that sometimes doesn't happen when running a lot of applications.
     For example, when I'm working with serveral gigabytes of
multimedia files I'll sometimes find that swap is
 being used, but when I want to go back and work on other things that
don't require a lot of memory usage I find that there's
 a lot of stuff still in swap and my hard drive works harder than usual.
Most troubling is my hard drive's red light
which STAYS on, even when the hard drive isn't being accessed!
     There's no way the system can know that I don't intend to work on
anything it has saved in swap, there's no way
the system can know that I'm going to use a whole new set of
applications so it makes good sense in such cases
to clear out swap manually.
     The same can be said with memory in ram. Anyone know how I could
flush ram so that there's nothing in the buffers?

Thanks,

-Tony

--------------------------------------------------------
 Abbreviate - af 2 millenia, a btr wy t rd n wri.
         http://www.eskimo.com/~oak/abr/

 
 
 

Flush swap manually?

Post by Norm Dresne » Sat, 13 Feb 1999 04:00:00


Whoa.  Swap space is used as an extension of physical RAM to form the
virtual memory space for _running_ programs, daemons, etc.  There's no way
you can accurately say that you don't intend to use what's in swap space
unless you don't intend to use some running process, in which case you can
simply terminate it (or kill it if it has no user interface).

As for buffers,
        man     sync

        Norm



Quote:>      Anyone know how I can manually flush swap?
>      I know people say that the system is smart and will do it on it's
> own, but that sometimes doesn't happen when running a lot of
applications.
>      For example, when I'm working with serveral gigabytes of
> multimedia files I'll sometimes find that swap is
>  being used, but when I want to go back and work on other things that
> don't require a lot of memory usage I find that there's
>  a lot of stuff still in swap and my hard drive works harder than usual.
> Most troubling is my hard drive's red light
> which STAYS on, even when the hard drive isn't being accessed!
>      There's no way the system can know that I don't intend to work on
> anything it has saved in swap, there's no way
> the system can know that I'm going to use a whole new set of
> applications so it makes good sense in such cases
> to clear out swap manually.
>      The same can be said with memory in ram. Anyone know how I could
> flush ram so that there's nothing in the buffers?

> Thanks,

> -Tony

> --------------------------------------------------------
>  Abbreviate - af 2 millenia, a btr wy t rd n wri.
>          http://www.eskimo.com/~oak/abr/


 
 
 

Flush swap manually?

Post by oak » Sat, 13 Feb 1999 04:00:00


This doesn't seem t be the case because last time my system used swap I
exited all my memory extensive applications and swap was still
being used according to "free" AND my hard drive light stayed on!

As for sync it only flushes RAM memory that needs to be written to disk, it
doesn't flush stuff in RAM entirely. There appears to be cache and buffers in
RAM which still hang around after sync.

I need to have RAM and swap in the same pristine state they were in when I
first booted the system.

Thanks,

-Tony

 Norm Dresner


> Whoa.  Swap space is used as an extension of physical RAM to form the
> virtual memory space for _running_ programs, daemons, etc.  There's no way
> you can accurately say that you don't intend to use what's in swap space
> unless you don't intend to use some running process, in which case you can
> simply terminate it (or kill it if it has no user interface).
> As for buffers,
>    man     sync
>    Norm


> >      Anyone know how I can manually flush swap?
> >      I know people say that the system is smart and will do it on it's
> > own, but that sometimes doesn't happen when running a lot of
> applications.
> >      For example, when I'm working with serveral gigabytes of
> > multimedia files I'll sometimes find that swap is
> >  being used, but when I want to go back and work on other things that
> > don't require a lot of memory usage I find that there's
> >  a lot of stuff still in swap and my hard drive works harder than usual.
> > Most troubling is my hard drive's red light
> > which STAYS on, even when the hard drive isn't being accessed!
> >      There's no way the system can know that I don't intend to work on
> > anything it has saved in swap, there's no way
> > the system can know that I'm going to use a whole new set of
> > applications so it makes good sense in such cases
> > to clear out swap manually.
> >      The same can be said with memory in ram. Anyone know how I could
> > flush ram so that there's nothing in the buffers?

 
 
 

Flush swap manually?

Post by sub.. » Sat, 13 Feb 1999 04:00:00




Quote:> Anyone know how I can manually flush swap?

Yes. I do it by:

        swapoff -a; swapon -a

Quote:> I need to have RAM and swap in the same pristine state they were in
> when I first booted the system.

That should do it.
 
 
 

Flush swap manually?

Post by Radovan Garab » Sat, 13 Feb 1999 04:00:00


:      Anyone know how I can manually flush swap?
:      I know people say that the system is smart and will do it on it's
: own, but that sometimes doesn't happen when running a lot of applications.
:      For example, when I'm working with serveral gigabytes of
: multimedia files I'll sometimes find that swap is
:  being used, but when I want to go back and work on other things that
: don't require a lot of memory usage I find that there's
:  a lot of stuff still in swap and my hard drive works harder than usual.
: Most troubling is my hard drive's red light
: which STAYS on, even when the hard drive isn't being accessed!
        ^^^^^
this is strange, and probably not related to swap.

:      There's no way the system can know that I don't intend to work on
: anything it has saved in swap, there's no way
: the system can know that I'm going to use a whole new set of
: applications so it makes good sense in such cases
: to clear out swap manually.

swapoff -a; swapon -a
but it should not matter... in fact, if you have some unused programs in
swap, more memory can be used for disk cache,

:      The same can be said with memory in ram. Anyone know how I could
: flush ram so that there's nothing in the buffers?

sync if you mean write cache
there is no need if you mean read cache.

--
 -------------------------------------------------------------
| Radovan Garabik    http://melkor.dnp.fmph.uniba.sk/~garabik |

 -------------------------------------------------------------

 
 
 

Flush swap manually?

Post by David Z. Maz » Sat, 13 Feb 1999 04:00:00


Please correct your From: line to be a valid mail address.  Corrected
in the citation.

oak> This doesn't seem t be the case because last time my system used
oak> swap I exited all my memory extensive applications and swap was
oak> still being used according to "free" AND my hard drive light
oak> stayed on!

The kernel probably only swaps things in as they're needed.

oak> I need to have RAM and swap in the same pristine state they were
oak> in when I first booted the system.

Why?

In general, the kernel does its best to make sure memory is used
efficiently.  Having all the data from all your applications in
physical memory isn't necessarily optimal: if a program hasn't been
used in a while but disk is being used heavily, it makes sense to swap
out the program to increase disk cache.  I *think* the kernel does
this.

--

"Hey, Doug, do you mind if I push the Emergency Booth Self-Destruct Button?"
"Oh, sure, Dave, whatever...you _do_ know what that does, right?"

 
 
 

Flush swap manually?

Post by oak » Fri, 19 Feb 1999 04:00:00


Quote:> In general, the kernel does its best to make sure memory is used
> efficiently.

The kernel can only guess what you're going to do next - only I know what
I'm going to do next. The bottom line is the following is happening:

   When I move around alot of data the amount of free memory is greatly
   reduced, and this causes more hard drive acticity when I'm reading
   something which isn't already in memory. Note that a reboot in this
   case minimizes the hard drive activity for the same applications
   presumabley because there's alot of ram memory available for the
   application at hand, and there isn't stuff there from an
   application which I'll no longer use. The kernel guesses that I
   may use that application again, but sometimes i KNOW I won't. In such
   cases it makes sense to flush everything in ram.

Quote:> .... if a program hasn't been
> used in a while but disk is being used heavily, it makes sense to swap
> out the program to increase disk cache.  I *think* the kernel does
> this.

That makes sense but the problem is things were getting STUCK in swap,
for some reason when I did "free" I could see that
there was stuff in swap EVEN THOUGH I'd exited all but the most basic
 applications. The swapoff worked to flush stuff out of swap! Now I'm
looking for a way to flush stuff out of RAM.

Thanks!

-Tony

 
 
 

Flush swap manually?

Post by oak » Fri, 19 Feb 1999 04:00:00


Quote:> :      For example, when I'm working with serveral gigabytes of
> : multimedia files I'll sometimes find that swap is
> :  being used, but when I want to go back and work on other things that
> : don't require a lot of memory usage I find that there's
> :  a lot of stuff still in swap and my hard drive works harder than usual.
> : Most troubling is my hard drive's red light
> : which STAYS on, even when the hard drive isn't being accessed!
>         ^^^^^
> this is strange, and probably not related to swap.

Whatever it is it's related to the amount of data I'm tossing around which
leaves swap and memory management suspect....I'll have to see if this
still happens after doing the "swapoff" mentioned here.

Quote:> :      There's no way the system can know that I don't intend to work on
> : anything it has saved in swap, there's no way
> : the system can know that I'm going to use a whole new set of
> : applications so it makes good sense in such cases
> : to clear out swap manually.
> swapoff -a; swapon -a
> but it should not matter... in fact, if you have some unused programs in
> swap, more memory can be used for disk cache,

Sometimes I want unused programs out of memory altogether because I don't
plan on using them again and want to give priority to a whole new set of
applications and data. Flushing ram and swap is a way to make sure these
new applications I'm using will have priority over other stuff that's
cluttering swap and ram. I found out how to do swapoff, now I'm looking to
flush ram.

Quote:> :      The same can be said with memory in ram. Anyone know how I could
> : flush ram so that there's nothing in the buffers?
> sync if you mean write cache
> there is no need if you mean read cache.

There DOES seem to be a need to do that because my hard drive works harder
when otherwise. For example, when I reboot, hard drive activity is at a
minimum; the only thing a reboot does is flush RAM. I tried sync but it
still doesn't give me the efficient memory management I get with a clean
reboot.

-Tony

--------------------------------------------------------
 Abbreviate - af 2 millenia, a btr wy t rd n wri.
         http://www.eskimo.com/~oak/abr/
------------------------------------------------------------

 
 
 

1. How do I manually flush out swap disk and cache?

How do I manually flush out swap disk and cache?

And I do have a good reason for doing it! Linux is NOT being optimal
with allocating resources so I have to give it a boost.

My system appears to be reaching a saturation point when running
memory intensive apps.

When running a bunch of apps, and using that master of all memory hogs
Communicator, the systems runs fine at the start, but after a while I
notice my disk drive is accessed more and more frequently.  When I see
it doing that I check my memory and find, not only that there is very
little memory free - that in itself would be fine - but the system is
now swapping to disk!  It didn't swap to disk at the start, it ran
just fine with all the apps I had for over an hour!  There's no reason
why it shouldn't run just as smoothe after an hour as it did an hour
before.  I have 64 megs of ram.

This is why I need to flush out swap and cache, i.e., to get the
system to run smoothly again without having to swap to disk.

BTW-It never gets to this saturation point if I don't run massive apps like
    communicator.

TIA

2. Diamond Stealth 64 DRAM & blue dots

3. Manually "flushing" file systems caching

4. amilo-a laptop lockup netcard problem

5. manually cleaning swap after a program crashes

6. Unix - Frequently Asked Questions (6/7) [Frequent posting]

7. How can I manually mount a swap partition or do it with Grub.

8. Preemptible linux kernel

9. HOw do you flush the swap space?

10. Flushing swap space

11. flushing the date on the swap partition.

12. MS-DOS Swap File vs. Swap Partition

13. Unwanted Swapping in 2.4.14-pre8, no swapping in 2.4.14-pre6aa1