New answers tagged


Try memleax, which detects memory leak of running process. It works like gdb and strace. It attaches a running process, hooks memory allocate/free APIs, records all memory blocks, and reports the blocks which lives longer than 5 seconds (you can change this time by -e option). It's lightweight, and more suitable for production environment. It supports ...


if [ "1024" == "$((32*32))" ]; then echo "The test worked" else echo "The test failed" fi This ought to work; if your shell does not use $(( )) for arithmetic, the strings will not match. You can also shorthand it with: [ "1024" == "$((32*32))" ] || echo "I can't math!"


You have two processes reading from /dev/pts/2. One is the shell (or some application) running there, the other is your application on pts/1. It's random which one is faster reading the available bytes.


Actually, your virtual stack size is 8388608 bytes (8 MB). Of course, it's natural to conclude that this can't be right, because that's a ridiculously large amount of memory for every thread to consume for its stack when 99% of the time a couple of KB is probably all they need. The good news is that your thread only uses the amount of physical memory that ...


The two main reasons to run a program directly without calling the shell are: Performance: Most programs that you would call from your C program are likely much smaller than the shell, which makes them start much more quickly. Environment control: Dealing with an additional layer of environment variables to deal with can be more complex to configure and ...

Top 50 recent answers are included