I’m working on a BlueZ client application (it runs as a daemon), that uses GLib’s D-Bus support. The application works fine, but I’m having some issues regarding measuring the real memory usage of the application. Using ps or top, the used memory always increases. I already checked for possible memory leaks with valgrind (with the respective suppression files) and it doesn’t give any error. This is the command I use for running valgrind’s memcheck:
Let me note that I’m aware that Glib uses a different memory mapping strategy, therefore the use of the G_SLICE environment variable when running valgrind. Also, I’m aware that this is why the ps and top don’t give the “correct” memory usage of the daemon.
My question is how to properly measure the memory usage of the application (if any) when debugging and when the daemon running is running, so I can attach a process like monit to check for possible excessive memory usage. I already stumbled upon the two following similar questions on the mailing list, but they didn’t received any reply: