Measure memory consumption of gdbus application

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Measure memory consumption of gdbus application

Jorge Miranda
Hi everybody,

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:

G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind —tool=memcheck --leak-check=full --leak-resolution=high --num-callers=20 --track-origins=yes --suppressions=glib-2.0.supp —suppressions=other.supp --log-file=app-memcheck.log app

The same happens when I check the heap usage with massif; it always increases. The command for massif follows:

G_SLICE=always-malloc valgrind --tool=massif --depth=7 --time-unit=ms \
    --alloc-fn=g_malloc --alloc-fn=g_malloc0 --alloc-fn=g_try_malloc \
    --alloc-fn=g_realloc --alloc-fn=g_slice_alloc --alloc-fn=g_slice_alloc0 \
    --alloc-fn=g_mem_chunk_all --alloc-fn=g_mem_chunk_alloc \
    --alloc-fn=dbus_realloc \
    --massif-out-file=app-massif.log app

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:



Any help is much appreciated! Thank you in advance!

Jorge M

_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list