Skip navigation

Category Archives: Article

I was facing memory leak issue with an application (application contains 12 .c file and each .c file contains approx 4000 to 7000 lines of code), So one solution is to debug the application with ‘valgrind’ and find out memory leak problem, but I was wondering about different solution than ‘valgrind’ tool. Since I wanted to fix the memory leak issue
with different method so I started exploring the area.

I have used the ‘top’ command in Linux and I know it gives complete snapshot of a System at given interval time. So I started looking for parameter which gives me physical(actual) memory used by the process/application, and I come to know about Resident set size (From wikipedia, “Resident set size is is the portion of a process’s memory that is held in RAM”) Now all I have to write and application that print the ‘RSS’ value.

Now that gives a birth to ‘Memwatch’ ( ‘Memwatch’ print total memory and actual physical memory usage of a process at certain interval.

So to trace the memory leak in application, I start the application with gdb and holds a break point at ‘main’ and I started execution function by function, while step over to the function, I constantly monitor the ‘Memwatch’ output and at one point I found that significantly memory has increase, so I debug that function and found that huge memory leakage was in the function (because usage of strdup and malloc without free implementation).

In short this is another short implementation of ‘top’ command but you can use the function ‘CheckUsage’ in your application and call it before and after the function and it will print the memory usage at begin and end of function, but this is lazy and another way to find out. Another solution is to achieve the same thing is with the mix of ‘top’, ‘awk’ and other Linux command.

‘Resident Set Size’ value help me to find out the memory leak and I wrote a small application on top of that, and I decided to share it with the world.

If you like this post, do ping me on Twitter at @suresh_kanzaria

Happy Hacking !




I encountered libtool version mismatch error while building Buildroot for ARM architecture on Ubuntu 32bit machine.

Below command help me to resolve this issue. I moved to the package director and apply the command. After this buildroot building process start smoothly.

‘autoreconf -vfi’

Hope this will save your time.

See you in next post. 🙂


While compiling MPlayer-1.0rc4, If you stuck at ‘undefined reference to `__isoc99_sscanf’, do the following to overcome the problem.

1. Since you configure the source, so object file generated, remove this file using make clean followed by make distclean i.e. make clean && make distclean.
2. run ./cofigure again, this will generate config.mak file.
3. open config.mak file by vi config.mak (OR any other editor).
4. Add ‘-D_GNU_SOURCE‘ to CFLAGS without quotes.
5. run make and you will be very happy to see your mplayer binary.

Hope this post will save your googling time. 🙂


Something Different is really gonna be something different. read on…

Before some days my friend gmail id hacked, we tried everything like password recovery, contact gmail support center for recover/reset password for that account, but didn’t work out anything. One day something pop up in my mind.

“Why don’t gmail do Password Protect a single email”, So that If email id hack, hacker can’t read password protected email. User can secure their important mail with password other than their email account,  and even if his/her id hack, nobody will read protected email unless one enter correct password.

More on this Gmail offer to select multiple conversion at once, and so it could be done to set password for multiple email at once(i.e. single password for multiple mail), user can move their important email to one label (in gmail label is like Folder) and then set password for multiple email at once rather than set password for single email, aka A single password for multiple mail.

I have also tweet about this to Google, but no reply so finally i decided to write one post. Here are my tweets and

I love gmail and I know Google people will do better than any one else. So I specify gmail  only in this post. But other  email provider can also take use of this, but please let me know if you gonna introduce this feature in your service. For my own happiness only.

Thank you for your time to read my Post.