Aug 28, 2017 08:50 PM
(This post was last modified: Aug 28, 2017 09:12 PM by zNinja.)
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.
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. :)
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. :)

