GNOME Bugzilla – Bug 523260
Access to the memory profilers data
Last modified: 2018-01-04 13:27:50 UTC
When you use the memory profiler by calling g_mem_set_vtable (glib_mem_profiler_table), it will collect statistics about how many bytes have been allocated and freed. The only way to access that information is by dumping it on stdout with g_mem_profile (). I want programmatic access to that data. It could be as simple as one function g_mem_profiler_amount_allocated () that returns profile_allocs - profile_frees. If such a function existed, it would make writing test code that detects memory leaks much easier.
Created attachment 168820 [details] [review] Proposed patch
I'd love to have this in glib 2.26, if possible. If anything needs to be corrected/improved please let me know.
g_mem_set_vtable() and g_mem_profiler_table have been deprecated since GLib 2.46, so this isn’t going to be supported. Use other (external) profiling tools instead.