# It's possible to free memory?

## LittleBug

Hi  @ all!

Some time ago my 1GB RAM stick says me "So long and thanks for all the fish!" then die. From that I limited to use only 512MB   :Crying or Very sad:  !

Well! this is not a huge problem but when I launch emerge or heavyweight application, of course, free memory go down and when the program are closed free memory doesn't rise. After a while if I launch any other program system goning to swap and this is not very good!

My question is: "Is it possible to get out garbage that stay in RAM without any pourpose?"

Thanks!

----------

## slackline

My understanding is that the kernel will free up memory when its requested unless its actually being used.

Thus when you close your heavy-weight application and it appears as though the memory isn't free you will find that if you start another heavy-weight application that requires the memory it will be available.

Memory is cheap, so grab some and get back to your previous levels (or even upgrade higher!).

----------

## cach0rr0

 *LittleBug wrote:*   

> when the program are closed free memory doesn't rise
> 
> 

 

that's cached. as mentioned above, the kernel will free up cache as needed when other applications request it. 

If indeed you're seeing a fair bit of swap used, you're quite simply running out of memory. 

If you really really really wan't to free up the cache:

```

echo 3 /proc/sys/vm/drop_caches

```

but i dont think that'll help - i think youre genuinely running out of memory

----------

## AllenJB

You generally shouldn't need to worry about memory management at all.

A quick tutorial on reading free memory. Run "free", and you'll see something like the following output.

```

             total       used       free     shared    buffers     cached

Mem:       2060008     999632    1060376          0     339304     177132

-/+ buffers/cache:     483196    1576812

Swap:      1502068        156    1501912

```

The actual free memory here is that on the second line. The rest is used for buffers/caches which speed up operation and are freed as applications require the memory.

----------

## iarwain

 *cach0rr0 wrote:*   

> 
> 
> ```
> 
> echo 3 /proc/sys/vm/drop_caches
> ...

 

You probably mean:

```

echo 3 > /proc/sys/vm/drop_caches

```

----------

## LittleBug

Hi there, sorry for late but I had some connection problems!

Mmm ok you says  that I shouldn't worry about free memory. I like Linux kernel a little more now!

Thanks for replies!

----------

## i92guboj

Yes. There's nothing living resident on your ram after running emerge or whatever.

It's just cached memory, which essentially is the same than free memory. You just need to learn how to read the top/free output. If you really hit swap intensively then the reason is straight: you either need to choose lighter programs or heavier hardware. :p

----------

## LittleBug

I'm thinking to use BadRam patch into kernel with the hope my old 1GB ram are not too bad....

What do you think about?

----------

## i92guboj

I know some people that uses this patch without problems. However the results are always dependent on the concrete hardware and the kind of damage. It's worth trying. If you experience instability or random crashes you can always take the bad module out again.

----------

## jcat

I know it's all relative, but RAM is so cheap now, it rather than mess around with strange patches, I would just by some more  :Smile: 

Cheers,

JustLast edited by jcat on Fri Apr 10, 2009 8:59 pm; edited 1 time in total

----------

## LittleBug

Yeah! I know, RAM isn't expensive BUT mine, is an old system and DDR is more expensive than DDR2, (here in Italy, Stupid Italy) AND I suppose that my old 1GB RAM stick isn't totally screwed up (I hope); than as long as (the patch for) linux kernel (eheh linux rulez) give me this opportunity, why waste it?   :Wink: 

----------

