# Minimum RAM?

## RBH

My new VPS has 64MB of RAM (and 64MB of swap that they forgot to include, initially ... ) and keeps throwing "out of memory" errors whenever I try to emerge something on the heavy side, like PHP or MySQL.

Now, I know from experience that compiling things like that on 128MB RAM works - albeit slowly - but I've not tried on 64. Is it an unreasonable hope, or will it purely be because the swap's not (yet) there?

----------

## DocReedSolomon

dont know what a "VPS" is, but if there is enough diskspace, you could try using "-j1" in your /etc/make.conf. that eats less memory, because just one gcc process is used instead of the usual 2.

----------

## i92guboj

I dont think you have any chance to compile anything like php or mysql with only 64 mb ram and no swap. Or course, the right thing to do would be to find another ram stick at least, but that is hard sometimes, so if you dont mind large compile times just some more swap space could do as well, though terribly slow, it *should* work.

Linux does not make a difference between physical ram and swap, so, as long as the virtual memory amount available is enough, the compilation will work. Of course, you can make some tea and wait sitting  :Razz: 

----------

## i92guboj

 *DocReedSolomon wrote:*   

> dont know what a "VPS" is, but if there is enough diskspace, you could try using "-j1" in your /etc/make.conf. that eats less memory, because just one gcc process is used instead of the usual 2.

 

Related to that, I think that if you rip off the -pipe flag from your cflags you might have also a slight decrease of the I/O during the compile time, since -pipe is just that, a compile time flag, the resulting object code will still be the same, only that the compilation times will be longer, since gcc will use disk space instead of pipes for interprocess comunication.

----------

## eddy89

Hi, I have serious problem emerging gcc-4 on 64 mb of ram, it swaps up to 200mb and of course it is very slow... there is some issue about this?

Anyway my machine work well and emerge all php, and apache, etc... but I have 700mb of swap (it uses at maximum 50mb of swap)

----------

## DocReedSolomon

 *eddy89 wrote:*   

> Hi, I have serious problem emerging gcc-4 on 64 mb of ram, it swaps up to 200mb and of course it is very slow... there is some issue about this?
> 
> Anyway my machine work well and emerge all php, and apache, etc... but I have 700mb of swap (it uses at maximum 50mb of swap)

 

may i ask a simple question?

why are you installing gcc4 at all?

why???

gcc 3.x is fine, security risks always fixed.

so why do you youself feel the need to emerge gcc4?   :Shocked: 

----------

## sundialsvc4

Another question...  why not simply expand the RAM?

----------

## eddy89

Ehm...   :Embarassed:  unfortunately it's an old(pc133) laptop (sodimm) that are almost rare.... And for the moment i don't need to...

Edit: Why gcc4? Well, becouse it's newer and modern  :Razz:  !!!

----------

## DocReedSolomon

we didnt ask you, we asked user "RBH"

it's his thread.

----------

## DocReedSolomon

 *eddy89 wrote:*   

> 
> 
> Edit: Why gcc4? Well, becouse it's newer and modern  !!!

 

dont. it doesnt pay out, really!

----------

## energyman76b

 *6thpink wrote:*   

> I dont think you have any chance to compile anything like php or mysql with only 64 mb ram and no swap. Or course, the right thing to do would be to find another ram stick at least, but that is hard sometimes, so if you dont mind large compile times just some more swap space could do as well, though terribly slow, it *should* work.
> 
> Linux does not make a difference between physical ram and swap, so, as long as the virtual memory amount available is enough, the compilation will work. Of course, you can make some tea and wait sitting 

 

that is simply not true. On my 1Gb, 3GB swap amd64 machine, I regularly run into out-of-memory situations when compiling stuff mit -j2. More than 2GB of swap were free, but it did not matter. Because there is a lot of stuff that simply can not be swapped out.

this is an example with 1gb of swap and 512mb ram, most of it free, but the 1gb ram 3gb swap looked similar:

 1151.984763] oom-killer: gfp_mask=0x80d2, order=0

[ 1151.984767] Mem-info:

[ 1151.984770] DMA per-cpu:

[ 1151.984772] cpu 0 hot: low 2, high 6, batch 1 used:3

[ 1151.984775] cpu 0 cold: low 0, high 2, batch 1 used:1

[ 1151.984776] Normal per-cpu:

[ 1151.984779] cpu 0 hot: low 62, high 186, batch 31 used:98

[ 1151.984781] cpu 0 cold: low 0, high 62, batch 31 used:32

[ 1151.984783] HighMem per-cpu: empty

[ 1151.984786] Free pages:        5520kB (0kB HighMem)

[ 1151.984790] Active:117324 inactive:1252 dirty:0 writeback:0 unstable:0 free:1380 slab:4119 mapped:117651 pagetables:562

[ 1151.984794] DMA free:2068kB min:88kB low:108kB high:132kB active:10436kB inactive:0kB present:15996kB pages_scanned:10623 all_unreclaimable? yes

[ 1151.984797] lowmem_reserve[]: 0 495 495

[ 1151.984802] Normal free:3452kB min:2800kB low:3500kB high:4200kB active:458860kB inactive:5008kB present:507584kB pages_scanned:0 all_unreclaimable? no

[ 1151.984805] lowmem_reserve[]: 0 0 0

[ 1151.984809] HighMem free:0kB min:128kB low:160kB high:192kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no

[ 1151.984811] lowmem_reserve[]: 0 0 0

[ 1151.984813] DMA: 1*4kB 0*8kB 1*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 1*2048kB 0*4096kB = 2068kB

[ 1151.984820] Normal: 113*4kB 21*8kB 7*16kB 1*32kB 0*64kB 1*128kB 0*256kB 1*512kB 0*1024kB 1*2048kB 0*4096kB = 3452kB

[ 1151.984827] HighMem: empty

[ 1151.984829] Swap cache: add 71, delete 71, find 0/0, race 0+0

[ 1151.984831] Free swap  = 995736kB

[ 1151.984833] Total swap = 996020kB

[ 1151.984834] Free swap:       995736kB

[ 1151.988117] 130992 pages of RAM

[ 1151.988119] 3265 reserved pages

[ 1151.988121] 24332 pages shared

[ 1151.988122] 0 pages swap cached

[ 1151.988154] Out of Memory: Killed process 8716 (cc1plus).

Edit:

and here an 1gb/1gb example, where the oom killer just went nuts:

[32663.239377] oom-killer: gfp_mask=0xd0, order=0

[32663.239381]

[32663.239382] Call Trace: <ffffffff8014fece>{out_of_memory+62} <ffffffff80151115>{__alloc_pages+549}

[32663.239415]        <ffffffff801511e4>{__get_free_pages+52} <ffffffff8017df2a>{__pollwait+74}

[32663.239427]        <ffffffff802e3503>{unix_poll+35} <ffffffff8017e255>{do_select+645}

[32663.239443]        <ffffffff8017dee0>{__pollwait+0} <ffffffff8017e6df>{sys_select+735}

[32663.239454]        <ffffffff802e34d3>{unix_ioctl+179} <ffffffff8017d591>{do_ioctl+33}

[32663.239468]        <ffffffff8010a9b6>{system_call+126}

[32663.239479] Mem-info:

[32663.239481] DMA per-cpu:

[32663.239483] cpu 0 hot: high 0, batch 1 used:0

[32663.239485] cpu 0 cold: high 0, batch 1 used:0

[32663.239487] DMA32 per-cpu:

[32663.239489] cpu 0 hot: high 186, batch 31 used:51

[32663.239491] cpu 0 cold: high 62, batch 15 used:61

[32663.239493] Normal per-cpu: empty

[32663.239494] HighMem per-cpu: empty

[32663.239498] Free pages:        7944kB (0kB HighMem)

[32663.239502] Active:236574 inactive:411 dirty:0 writeback:0 unstable:0 free:1986 slab:7842 mapped:236198 pagetables:2268

[32663.239506] DMA free:4016kB min:44kB low:52kB high:64kB active:8116kB inactive:0kB present:12140kB pages_scanned:9383 all_unreclaimable? yes

[32663.239509] lowmem_reserve[]: 0 993 993 993

[32663.239515] DMA32 free:3928kB min:4008kB low:5008kB high:6012kB active:938180kB inactive:1644kB present:1017768kB pages_scanned:1110002 all_unreclaimable? yes

[32663.239518] lowmem_reserve[]: 0 0 0 0

[32663.239521] Normal free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no

[32663.239524] lowmem_reserve[]: 0 0 0 0

[32663.239527] HighMem free:0kB min:128kB low:128kB high:128kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no

[32663.239530] lowmem_reserve[]: 0 0 0 0

[32663.239532] DMA: 0*4kB 0*8kB 1*16kB 1*32kB 0*64kB 1*128kB 1*256kB 1*512kB 1*1024kB 1*2048kB 0*4096kB = 4016kB

[32663.239538] DMA32: 0*4kB 5*8kB 7*16kB 0*32kB 1*64kB 1*128kB 0*256kB 1*512kB 1*1024kB 1*2048kB 0*4096kB = 3928kB

[32663.239545] Normal: empty

[32663.239546] HighMem: empty

[32663.239550] Swap cache: add 85318, delete 76238, find 101568/105563, race 0+0

[32663.239552] Free swap  = 904488kB

[32663.239553] Total swap = 996020kB

[32663.239555] Free swap:       904488kB

[32663.245748] 262064 pages of RAM

[32663.245751] 5375 reserved pages

[32663.245752] 202019 pages shared

[32663.245754] 9080 pages swap cached

[32663.245833] Out of Memory: Kill process 15896 (kdeinit) score 129680 and children.

[32663.245836] Out of memory: Killed process 15901 (klauncher).

[32663.245930] oom-killer: gfp_mask=0x200d2, order=0

[32663.245932]

[32663.245933] Call Trace: <ffffffff8014fece>{out_of_memory+62} <ffffffff80151115>{__alloc_pages+549}

[32663.245956]        <ffffffff801618c3>{read_swap_cache_async+67} <ffffffff80159e73>{swapin_readahead+99}

[32663.245967]        <ffffffff8015a4e2>{__handle_mm_fault+1570} <ffffffff80296193>{sock_def_readable+35}

[32663.245979]        <ffffffff8011ce56>{do_page_fault+966} <ffffffff8010b2e5>{error_exit+0}

[32663.246005]        <ffffffff8012b434>{do_syslog+436} <ffffffff8012b3e8>{do_syslog+360}

[32663.246013]        <ffffffff8013dda0>{autoremove_wake_function+0} <ffffffff8016bd3d>{vfs_write+301}

[32663.246022]        <ffffffff8013dda0>{autoremove_wake_function+0} <ffffffff8016be63>{sys_write+83}

[32663.246031]        <ffffffff8012b659>{sys_syslog+9} <ffffffff8010a9b6>{system_call+126}

[32663.246043] Mem-info:

[32663.246044] DMA per-cpu:

[32663.246046] cpu 0 hot: high 0, batch 1 used:0

[32663.246048] cpu 0 cold: high 0, batch 1 used:0

[32663.246050] DMA32 per-cpu:

[32663.246052] cpu 0 hot: high 186, batch 31 used:51

[32663.246054] cpu 0 cold: high 62, batch 15 used:61

[32663.246056] Normal per-cpu: empty

[32663.246058] HighMem per-cpu: empty

[32663.246060] Free pages:        7944kB (0kB HighMem)

[32663.246064] Active:236574 inactive:411 dirty:0 writeback:0 unstable:0 free:1986 slab:7842 mapped:236198 pagetables:2268

[32663.246068] DMA free:4016kB min:44kB low:52kB high:64kB active:8116kB inactive:0kB present:12140kB pages_scanned:9383 all_unreclaimable? yes

[32663.246071] lowmem_reserve[]: 0 993 993 993

[32663.246076] DMA32 free:3928kB min:4008kB low:5008kB high:6012kB active:938180kB inactive:1644kB present:1017768kB pages_scanned:1110062 all_unreclaimable? yes

[32663.246079] lowmem_reserve[]: 0 0 0 0

[32663.246082] Normal free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no

[32663.246085] lowmem_reserve[]: 0 0 0 0

[32663.246088] HighMem free:0kB min:128kB low:128kB high:128kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no

[32663.246091] lowmem_reserve[]: 0 0 0 0

[32663.246093] DMA: 0*4kB 0*8kB 1*16kB 1*32kB 0*64kB 1*128kB 1*256kB 1*512kB 1*1024kB 1*2048kB 0*4096kB = 4016kB

[32663.246100] DMA32: 0*4kB 5*8kB 7*16kB 0*32kB 1*64kB 1*128kB 0*256kB 1*512kB 1*1024kB 1*2048kB 0*4096kB = 3928kB

[32663.246106] Normal: empty

[32663.246108] HighMem: empty

[32663.246111] Swap cache: add 85318, delete 76238, find 101568/105564, race 0+0

[32663.246113] Free swap  = 904488kB

[32663.246115] Total swap = 996020kB

[32663.246116] Free swap:       904488kB

[32663.251972] 262064 pages of RAM

[32663.251974] 5375 reserved pages

[32663.251976] 202019 pages shared

[32663.251978] 9080 pages swap cached

[32663.252173] oom-killer: gfp_mask=0xd0, order=0

[32663.252175]

[32663.252176] Call Trace: <ffffffff8014fece>{out_of_memory+62} <ffffffff802e6da4>{thread_return+0}

[32663.252197]        <ffffffff80151115>{__alloc_pages+549} <ffffffff801511e4>{__get_free_pages+52}

[32663.252207]        <ffffffff8017df2a>{__pollwait+74} <ffffffff802e3503>{unix_poll+35}

[32663.252217]        <ffffffff8017e255>{do_select+645} <ffffffff8017dee0>{__pollwait+0}

[32663.252233]        <ffffffff8017e6df>{sys_select+735} <ffffffff802e34d3>{unix_ioctl+179}

[32663.252242]        <ffffffff8017d591>{do_ioctl+33} <ffffffff8010a9b6>{system_call+126}

[32663.252260] Mem-info:

[32663.252262] DMA per-cpu:

[32663.252264] cpu 0 hot: high 0, batch 1 used:0

[32663.252266] cpu 0 cold: high 0, batch 1 used:0

[32663.252267] DMA32 per-cpu:

[32663.252270] cpu 0 hot: high 186, batch 31 used:52

[32663.252272] cpu 0 cold: high 62, batch 15 used:61

[32663.252273] Normal per-cpu: empty

[32663.252275] HighMem per-cpu: empty

[32663.252278] Free pages:        7944kB (0kB HighMem)

[32663.252281] Active:236574 inactive:411 dirty:0 writeback:0 unstable:0 free:1986 slab:7842 mapped:236198 pagetables:2268

[32663.252286] DMA free:4016kB min:44kB low:52kB high:64kB active:8116kB inactive:0kB present:12140kB pages_scanned:9383 all_unreclaimable? yes

[32663.252288] lowmem_reserve[]: 0 993 993 993

[32663.252294] DMA32 free:3928kB min:4008kB low:5008kB high:6012kB active:938180kB inactive:1644kB present:1017768kB pages_scanned:1110122 all_unreclaimable? yes

[32663.252297] lowmem_reserve[]: 0 0 0 0

[32663.252300] Normal free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no

[32663.252302] lowmem_reserve[]: 0 0 0 0

[32663.252306] HighMem free:0kB min:128kB low:128kB high:128kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no

[32663.252309] lowmem_reserve[]: 0 0 0 0

[32663.252311] DMA: 0*4kB 0*8kB 1*16kB 1*32kB 0*64kB 1*128kB 1*256kB 1*512kB 1*1024kB 1*2048kB 0*4096kB = 4016kB

[32663.252317] DMA32: 0*4kB 5*8kB 7*16kB 0*32kB 1*64kB 1*128kB 0*256kB 1*512kB 1*1024kB 1*2048kB 0*4096kB = 3928kB

[32663.252324] Normal: empty

[32663.252325] HighMem: empty

[32663.252328] Swap cache: add 85318, delete 76238, find 101568/105564, race 0+0

[32663.252330] Free swap  = 904488kB

[32663.252332] Total swap = 996020kB

[32663.252334] Free swap:       904488kB

[32663.258198] 262064 pages of RAM

[32663.258201] 5375 reserved pages

[32663.258203] 202019 pages shared

[32663.258204] 9080 pages swap cached

----------

