Tag Info

Hot answers tagged

42

I would suggest running a VM with limited memory and testing the software in that would be a more efficient test than trying to fill memory on the host machine. That method also has the advantage that if the low memory situation causes OOM errors elsewhere and hangs the whole OS, you only hang the VM you are testing in not your machine that you might have ...


38

stress is a workload generator that simulates cpu/mem/io/hdd stress on POSIX systems. This call should do the trick on Linux: stress --vm-bytes $(awk '/MemFree/{printf "%d\n", $2 * 0.9;}' < /proc/meminfo)k --vm-keep -m 1 Adapt the /proc/meminfo call with free(1)/vm_stat(1)/etc. if you need it portable.


26

Two potential problems: grep -R (except for the modified GNU grep found on OS/X 10.8 and above) follows symlinks, so even if there's only 100GB of files in ~/Documents, there might still be a symlink to / for instance and you'll end up scanning the whole file system including files like /dev/zero. Use grep -r with newer GNU grep, or use the standard ...


14

Red Hat Enterprise Linux (RHEL) These are probably a good basis, looking at RHEL6's capabilities, they're covered here, titled: Red Hat Enterprise Linux 6 technology capabilities and limits.     NOTE: [5] The architectural limits are based on the capabilities of the Red Hat Enterprise Linux kernel and the physical hardware. Red Hat ...


13

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 ...


12

Use cron (or anacron). Cron is designed for running things at intervals. That is the only thing it does, and there has been a lot of work put into cron for many years to make it what it is today. The chances that you're going to write a better scheduler in your script are effectively nil. Using cron will work better, avoid having unnecessary code in your ...


9

There is a command-line option which does that: -M : Detect memory units Show memory units (k/M/G) and display floating point values in the memory summary. So it is sufficient to run top like that: top -M


8

You just need to understand Memory Concept As per your Output Of /proc/meminfo , You just need to Notice below things : Buffers :- A buffer is something that has yet to be "written" to disk. It represents how much RAM is dedicated to cache disk block. "Cached" is similar to "Buffers", only this time it caches pages from file reading Cached :- A cache ...


8

top -M doesn't work on any of the Fedora, Debian or Ubuntu distros to my knowledge. I just tried it and it's not in the procps-ng package that provides top. There are many implementations of top so one needs to pay special attention to which they use. In general it's best to use free with switching to get the amount of memory free on Linux. procps vs. ...


7

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 ...


7

Since kernel version 2.6.28, Linux uses a Split Least Recently Used (LRU) page replacement strategy. Pages with a filesystem source, such as program text or shared libraries belong to the file cache. Pages without filesystem backing are called anonymous pages, and consist of runtime data such as the stack space reserved for applications etc. Typically pages ...


7

I keep a function to do something similar in my dotfiles. https://github.com/sagotsky/.dotfiles/blob/master/.functions#L248 function malloc() { if [[ $# -eq 0 || $1 -eq '-h' || $1 -lt 0 ]] ; then echo -e "usage: malloc N\n\nAllocate N mb, wait, then release it." else N=$(free -m | grep Mem: | awk '{print int($2/10)}') if [[ $N -gt $1 ]] ...


7

The text segment is the mapping at 0x400000 - it's marked 'r-x' for readable and executable. The mapping at 0x600000 is read-only, so that's almost certainly the ".rodata" section of the executable file. GCC puts C string literals into a read-only section. The mapping at 0x601000 is 'rw-', so that's probably the famed heap. You could have your executable ...


7

The memory represented by "buffers/cache" in free is your filesystem cache, which Linux caches to speed up reading data from your disk, as hitting the disk is generally a fairly slow way to access data repeatedly. As such, they are cached in memory, and transparently served from there if available. You can see which blocks are currently in your cache by ...


6

The difference you are observing isn't actually due to swap space being unaccounted for. The "(deleted)" that the kernel sometimes appends to /proc/*/exe links is output by readlink and is causing parse errors in your awk script, and you are effectively not counting processes whose binaries are no longer present in your total. Some kernels append the word ...


6

If you want to look at a particular process named e.g. wing_ide, then ps a | fgrep wing_ide | fgrep -v fgrep gives you a number at the beginning of the line (in my case 29837) use this number as follows: fgrep '[heap]' /proc/29837/maps The output look like: 01d56000-07026000 rw-p 00000000 00:00 0 [heap] If you do this on a ...


6

You really ought not to ask two questions in one, but... Question 1 Some of that memory is used for the kernel code itself, some is reserved, etc. The kernel spits it out in the system boot messages: [ 0.000000] Memory: 6106920k/7340032k available (3633k kernel code, 1057736k absent, 175376k reserved, 3104k data, 616k init) The "absent" line is ...


5

EDIT: Answer updated/corrected. Although the kernel documentation about this topic says that "Rootfs is a special instance of ramfs (or tmpfs, if that's enabled) [...]", it is in reality still a ramfs, as a short look in the code shows (rootfs is not mentioned in mm/shmem.c). Some patches (see e.g. here and here) were sent to the Linux kernel mailing list ...


5

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

Getting swap back to 0 is not a useful goal. There is nothing ipso facto wrong about having things in swap. It is quite possible for a program to load resources it doesn't actually use, and for the kernel to notice this and swap them out, freeing the memory for use by programs that can actually make use of it right now. This situation comes up a lot in ...


5

You can't load a kernel module at a specific physical address. You can't load a kernel module at a specific virtual address. The kernel decides where it loads the module. Inside the kernel, of course, you can do what you want. But I think arranging to load a driver at a specific address would require a lot of deep changes. I fail to see what would require ...


5

1. Virtual memory The system will ensure that processes will get the requested amount of memory despite being greater than physical memory. By this way the kernel allocates a virtual memory space of the maximum physical memory size it can handle. E.g. on a 32bit machine, the kernel will allocate a total of 2^32 i.e. 4GB of virtual addresses to every process ...


5

Use cron because it is a better and more standard practice. At least if this is something that will regularly run (not just something you patched together in a minute). cron is a cleaner and more standard way. It's also better because it runs the shell detached from a terminal - no problem with accidental termination and dependencies on other processes. ...


5

When an server process starts it issues some system calls (socket() and listen()). The system then opens the port and creates a socket file descriptor for the process to interact with. You can see this with: Find the Apache master process id: root@frisbee:~# ps -ef | grep apache | grep root root 27440 1 0 16:06 ? 00:00:00 /usr/sbin/apache2 ...


4

That won't work. The number of clock cycles each instruction takes to execute ( they take quite a few, not just one ) depends heavily on the exact mix of instructions that surround it, and varies by exact cpu model. You also have interrupts coming in and the kernel and other tasks having instructions executed mixed in with yours. On top of that, the ...


4

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 ...


4

You only get a clear picture of the stack just as the kernel hands off to ld.so, the dynamic linker. You can find a basic picture here. That shows argc, argv and envp, the traditional 3 arguments to a C program's int main(int argc, char **argv, char **envp). That view is somewhat simplistic. An ELF auxiliary vector exists on the stack, too, and conveys a ...


4

I usually do find ~/Documents | xargs grep -ne 'expression' I tried a bunch of methods, and found this to be the fastest. Note that this doesn't handle files with spaces the file name very well. If you know this is the case and have a GNU version of grep, you can use: find ~/Documents -print0 | xargs -0 grep -ne 'expression' If not you can use: find ...


4

If I understand that script correctly, it doesn't actually enable swap in any way. Instead it just pretends that the system has swap by replacing /proc/meminfo so that free and htop believe that the system has swap, but the kernel is in no way able to use this fake swap. If you look at the script, you may notice that no swap file or partition is mentioned ...


4

The segmentation registers are a legacy from the early days of the x86 processors, when the offset wasn't large enough to address all of the memory the processor could address. The original 8086 had a 20-bit address space, but could only use a 16-bit offset. You had to use the segment registers to specify which 64KB of the 1024KB address space you wanted. ...



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