If you really want to know what amount of memory your application actually uses, you need to run it within a profiler. For example, valgrind
can give you insights about the amount of memory used, and, more importantly, about possible memory leaks in your program.
look into,
http://valgrind.org/docs/manual/mc-manual.html
Valgrind is basically an x86 emulator that checks all reads and writes of memory, intercepts all calls to allocate and deallocate memory. The memcheck tool of valgrind can detect the following:
1) Use of uninitialised memory,
2) Reading/writing memory after it has been free'd
3) Reading/writing off the end of malloc'd blocks
4) Reading/writing inappropriate areas below the stack.
5) Memory leaks
6) Mismatched use of malloc/new/new[] vs free/delete/delete[]
7) Overlapping src and dst pointers in memcpy() and related functions
8) Doubly freed memory
9) Passing unaddressable bytes to a system call