We have integrated GStreamer 1.22 with our application and started seeing memory leaks. We have captured the UMDH snap shots to identify the memory leak. It is pointing to one of the libglig api. Kindly let us know if any change made recently on this api (version 2.72).
None of those functions call g_shell_parse_argv(). I suggest you look at the full stack from your leak report and then read through the code of the functions being called (it’s all open source) to work out which bit of code ends up owning the memory allocated by g_shell_parse_argv() and not freeing it.
And if you can’t figure it out yourself, then post the full stack (preferably in text format rather than a screenshot) as without seeing the stack it won’t be possible for anybody to provide much help.
Note that g_shell_parse_argv+11A1 could even be a different function than g_shell_parse_argv! Most likely the debugger is using positions relative to named exports. I suggest building a debug version of GLib
We have integrated our application with the GStreamer which internally uses GLib. We are trying to build the debug version of GStreamer now.
Meanwhile, we would like to understand few scenarios on GLib. We have made code so that GMainloop will be created and quit on the EOS. We do unref of the GMain loop means clearing the loop and objects properly. But still, we do see a memory leak in GLib. We have used UMDH logs to identify the leak in our application. The first 2 highest allocations are pointing to Glib api’s as follows,
As Luca says, looking at leak backtraces is pointless until you’ve built and are running with a debug version of GStreamer and GLib. Those backtraces are not giving you any useful information as the symbol information isn’t all there.
As I mentioned earlier, we are trying to build debug version of GStreamer and Glib to get more information on call trace.
But still, we have tried one of the fix to address our application crash issue. As part of the fix, we have moved the g_main_loop_run to g_idle_add function. After the fix, we observed the memory leak.
Could any one please comment on the adding the g_main_loop_run in g_idle_add api ? Adding the gmain loop in the idle queue will cause any issue on clearing memory ?
It sounds like you are probably confused and are doing something wrong.
Do you have only one main context? That would be the most common case.
If you only have one main context, then how is your idle callback ever called if the main context is not already being iterated? If the main context is already being iterated, you almost surely do not want to try iterating it recursively (this would be dangerous), so running the main loop from an idle callback doesn’t sound good. And if the main context is not already being iterated, then your idle callback is not ever going to be called, so that doesn’t sound good either.
If you have multiple main contexts, then we don’t have enough information to answer your questions, because you haven’t explained how your app uses main contexts.
And to add to that: without seeing your code, we cannot really help answer questions about it. Please post a link to the relevant bit of your code if you have further questions.