Tag Info

Hot answers tagged

54

Emptying the buffers cache If you ever want to empty it you can use this chain of commands. $ free && sync && echo 3 > /proc/sys/vm/drop_caches && free total used free shared buffers cached Mem: 1018916 980832 38084 0 46924 355764 -/+ buffers/cache: 578144 ...


27

What might be happening if a process is "killed due to low RAM"? It's sometimes said that linux by default never denies requests for more memory from application code -- e.g. malloc().1 This is not in fact true; the default uses a heuristic whereby Obvious overcommits of address space are refused. Used for a typical system. It ...


26

The best way to create a ram disk on linux is tmpfs. It's a filesystem living in ram, so there is no need for ext2. You can create a tmpfs of 16Gb size with: mount -o size=16G -t tmpfs none /mnt/tmpfs


22

There is no need to do this, the kernel manages RAM efficiently by using it for caches and buffers if it is not needed by processes. If processes request more RAM the kernel will deallocate caches and buffers if necessary to satisfy the request. This ServerFault answer explains how to interpret the memory usage reported by free.


18

Kernel is a bit of a misnomer. The Linux kernel is comprised of several proceses/threads + the modules (lsmod) so to get a complete picture you'd need to look at the whole ball and not just a single component. Incidentally mine shows slabtop: Active / Total Size (% used) : 173428.30K / 204497.61K (84.8%) The man page for slabtop also had this to ...


17

NOTE: I'm going to assume that your machine has a memory mapping unit (MMU). There is a Linux version (µClinux) that doesn't require an MMU, and this answer doesn't apply there. What is an MMU? It's hardware—part of the processor and/or memory controller. Understanding shared library linking doesn't require you to understand exactly how an MMU works, just ...


14

This won't happen to you if you only ever load 1G of data into memory. What if you load much much more? For example, I often work with huge files containing millions of probabilities which need to be loaded into R. This takes about 16GB of RAM. Running the above process on my laptop will cause it to start swapping like crazy as soon as my 8GB of RAM have ...


11

memmap There is this tutorial titled: Bad Memory HowTo which discusses disabling memory via the kernel using the memmap argument to the kernel. According to the howto you have 2 options when it comes to memmap: Turn off everything after the bad memory - (mem=###M option) Turn off just the memory around the bad memory - (memmap=#M$###M option) With the ...


10

First, if your BIOS/UEFI does not detect correctly your RAM, then your OS won't do any better. There's no need to go any further if your BIOS display incorrect information about your setup. => You probably have at least an hardware problem. EDIT: From your dmesg | grep memory, it seems that you have in fact an hardware problem, located in your embedded ...


10

Linux is very efficient in using RAM. There is little surprise that you see little if any speedup with tmpfs. The largest pieces to read into memory (and thus able to slow the process down) are the tools (compiler, assembler, linker), and in a longish make they will be loaded into memory at startup and never leave it. What is left is reading in source (the ...


9

You don't have to do all that, you can just mount /tmp as tmpfs by using a line like the following in /etc/fstab: tmpfs /tmp tmpfs mode=1777,nosuid,nodev 0 0 You can also do it live (but bear in mind stuff that is currently in /tmp on your current filesystem will not be able to be accessed except through the inode and currently open file descriptors, so ...


9

Check out this How do I detect the RAM memory chip specification from within a Linux machine question. This tool might help: http://www.cyberciti.biz/faq/check-ram-speed-linux/ $ sudo dmidecode --type 17 | more Sample output: # dmidecode 2.9 SMBIOS 2.4 present. Handle 0x0018, DMI type 17, 27 bytes Memory Device Array Handle: 0x0017 Error ...


8

You don't need to do so. There are two possiblities, if there is something in the cache: it is needed again it is not needed again In the first case, it is better if it remains in RAM as long as possible, which means: another process needs the RAM. Then it is discarded automatically without your intervention. In the second case, it doesn't disturb. ...


8

Memtest86+ (I used 4.20) can output a badram format directly. Press 'c' to reach the configuration dialogue Then '4' for "Error Report Mode" Then '3' for "BadRAM Patterns" The output will change from a list of individual test failures to a series of badram= lines, each containing one more new bad sector. Because the lines append and coalesce ...


7

You can use ps: ps axo pid,args,pmem,rss,vsz --sort -pmem,-rss,-vsz | head -n 5


6

No problem in that. Linux is borrowing the RAM for caching. This is desirable (RAM is faster than disk) and absolutely normal behaviour. From that link: Why does top and free say all my ram is used if it isn't? This is just a misunderstanding of terms. Both you and Linux agree that memory taken by applications is "used", while memory that isn't ...


6

The problem is that the maximum size of a ramdisk, more specifically of size of memory that can be accessed via the ramdisk driver is configured at compiletime, can be overwritten at boottime, but remains fixed once the kernel is loaded into memory. The default value is probably measured in Megabytes. If I recall correctly the memory for a ramdisk is ...


6

What you're experiencing is an Error Detection and Correction event. Given the error includes this bit: MC0 you're experiencing a memory error. This message is telling you where specifically you're experiencing the error. MC0 means the RAM in the first socket (#0). The rest of that message is telling you specifically within that RAM DIMM the error occurred. ...


5

Pre-loading a movie to memory probably only matters for network streams or if you don't want your disk respinning. In any case you can try increasing cache size in your media player. With mplayer it can be achieved with following command. mplayer -cache <HUGE_NUMBER_IN_KILOBYTES> <VIDEO_FILE> Usually the problem with slow/choppy video is in ...


5

32-bit processes can only allocate up to 1, 2, 3, or about 4GB, depending on which memory split was chosen when the 32-bit kernel was built. 32-bit processes on a 64-bit kernel can allocate about 4GB. 64-bit processes on a 64-bit x86-64 kernel can allocate up to 128TiB.


5

Search /var/log/dmesg for memory map (grep for 'e820') and count how many memory is reported there as usable. This is what BIOS tells to loaded OS for memory. (This is correct only for old-styled boot. I don't know how the memory is reported if EFI-styled boot is used, but I guess there is similar report.) Also, reporting 16GB by BIOS while 32GB is ...


5

Yes, it is a strong solution, but powerfull! Making r/o useable You have to mount some directories in rw, like /var, /etc and maybe /home. This could by done using aufs or unionfs. I like this another way, using /dev/shm and mount --bind: cp -a /var /dev/shm/ mount --bind /dev/shm/var /var You could before, move all directories who have not to change in ...


5

From the kernel documentation, in Documentation/x86/x86_64/mm.txt: Virtual memory map with 4 level page tables: 0000000000000000 - 00007fffffffffff (=47 bits) user space, different per mm 247 bytes = 128TiB


5

OpenVZ & Memory The failcnt is going up on privvmpages, so your container is unable to allocate any more virtual memory space from the host: root@server: ~ # cat /proc/user_beancounters Version: 2.5 uid resource held maxheld barrier limit failcnt privvmpages ...


5

This is just a thought and has more than one downside, but it might be usable enough anyway. How about creating an image file and a filesystem inside it on top of ramfs, then mount the image as a loop device? That way you could limit the size of ramdisk by simply limiting the image file size. For example: $ mkdir -p /ram/{ram,loop} $ mount -t ramfs none ...


5

Huge pages are for allocating chunks of memory, not writing them. Normally when applications need large amounts of memory, they have to allocate many "pages". A page is simply a chunk of physical memory. Normally this chunk is only a few KB. So when an application is doing a lot of memory intensive operations that span many pages, it's expensive for the ...


5

There is more than one definition of the chunk size for memory writes. You could consider it to be: the width of the store instruction (store byte, store word, …), typically 1, 2, 4, 8 or 16; the width of a cache line, typically something like 16 or 64 bytes (and different cache levels may have different line widths); the width of the memory bus, which is ...


4

use ramfs instead of tmpfs. ramfs is a ramdisk (no swap) tmpfs can be both in your /etc/fstab: none /path/to/location ramfs defaults,size=512M 0 0 edit the size parameter to whatever you like but be careful not to exceed your actual amount of ram. NOTE: the use of a ramfs instead of tmpfs is not something i would recommend. you will find ...


4

Run top. Press O to change the sort order, and Q for RESident memory.


4

Yes it is possible. You can first mount a tmpfs partition and then play your video file from there. I mount my /tmp partition in RAM since the contents do not need to be preserved between reboots and there are definite speed benefits. Here is my entry in my /etc/fstab which creates it on each boot: tmpfs /tmp tmpfs ...



Only top voted, non community-wiki answers of a minimum length are eligible