Are some allocators lazy?

On Linux, malloc requests memory with sbrk() or mmap() – either way, your address space is expanded immediately, but Linux does not assign actual pages of physical memory until the first write to the page in question. You can see the address space expansion in the VIRT column, while the actual, physical memory usage in … Read more

What does localhost means inside a Docker container?

From inside a container, localhost always refers to the current container. It never refers to another container, and it never refers to anything else running on your physical system that’s not in the same container. It’s not usually useful to make outbound connections to localhost or configure localhost as your database host. From a shell … Read more

vscode “#include errors detected. Please update your includePath

Although the question mentions Arduino, the following suggestions apply basically any time VSCode tells you to “update your includePath”. What is includePath? The includePath is an attribute in c_cpp_settings.json, which is in the .vscode folder of the main folder you have opened in VSCode using File → Open Folder. You can edit c_cpp_settings.json directly, but … Read more

Linux PID recycling [closed]

As new processes fork in, PIDs will increase to a system-dependent limit and then wrap around. The kernel will not reuse a PID before this wrap-around happens. The limit (maximum number of pids) is /proc/sys/kernel/pid_max. The manual says: /proc/sys/kernel/pid_max (since Linux 2.5.34) This file specifies the value at which PIDs wrap around (i.e., the value … Read more

How to upgrade glibc from version 2.12 to 2.14 on CentOS?

You cannot update glibc on Centos 6 safely. However you can install 2.14 alongside 2.12 easily, then use it to compile projects etc. Here is how: mkdir ~/glibc_install; cd ~/glibc_install wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz tar zxvf glibc-2.14.tar.gz cd glibc-2.14 mkdir build cd build ../configure –prefix=/opt/glibc-2.14 make -j4 sudo make install export LD_LIBRARY_PATH=/opt/glibc-2.14/lib

Return value of sed for no match

as @cnicutar commented, the return code of a command means if the command was executed successfully. has nothing to do with the logic you implemented in the codes/scripts. so if you have: echo “foo”|sed ‘/bar/ s/a/b/’ sed will return 0 but if you write some syntax/expression errors, or the input/file doesn’t exist, sed cannot execute … Read more