Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

Interesting memory leak gtk+ 3.12.1

In my app I have an window object wrapper for gtk to be handy for use.

I notice i have a memory leeks, but can't figure out where.
after installing the object once it is not destroyed, just reused.
it has fallowing methods that will be used in this example on pastebin
Now for test purpose I isolated created window wrapper object and allow program to run only this 3 functions above in interval of 100 milliseconds.
PHP Code

<?php 
// on paste bin I forgot to add definition of get_name() method
std::string nwTabWindow::get_name() const
{
    
std::lock_guard<std::mutex> g(win_data->prop_mutex);
    return 
win_data->name;
}

gboolean switcher(gpointer data){
nwTabWindow*win = (nwTabWindow*)data;
if(
win->is_opened())
win->unsafe_close();
else {
win->unsafe_open();
win->unsafe_show();
}
return 
true;
}
nwTabWindow*w = new nwTabWindow("title","name");
g_timeout_add(100,switcher,w); 


By this test after many others I figured out that leak is in this tree functions unsafe_close, unsafe_open, unsafe_show but do not know where exactly. :/
I know that gtk has few bugs that lead to little memory leaks, but I got 30 mb leak in less then 20 minutes by this test, which is huge.
If someone notice where I do wrong please write. Thanks. :)
Well after some research and help of gtk guys i realizes that bug causing GtkHeaderBar.
So writing here for someone who face same problem in future and looking for an answer.
Bug tracking link


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by draxyeeJul 12, 2020 10:06 PM 9 954 Jul 12, 2020 10:06 PM
Last Post: iolaka
[C#] by draxyeeSep 12, 2019 05:15 AM 10 663 Sep 12, 2019 05:15 AM
Last Post: riu41776
[C] by zNinjaJan 26, 2018 04:03 AM 0 106 Jan 26, 2018 04:03 AM
Last Post: zNinja