memory leaks ( previous thread )




I am sorry that I cannot reply to the thread created by Trigve Siver directly, I have just joined the mailing list.

I am currently evaluating gtkmm for use in our current project and have encountered the same memory leaks Trigve Siver has reported under WinXP/VS2005, latest gtkmm stable release. From my expierience, the memory leaks reported by the crt-debugging functions are valid.

Considering the application structure we already have and the requirements we must meet, we intend to use gtkmm to build an UI that resides in an implicity linked DLL which can be loaded and unloaded at runtime. Therefore I have changed the code snippet posted in the previous thread to the following :

#include <windows.h>
#include <crtdbg.h>

typedef void (*PC) (int argc, char *argv[]);

int main(int argc, char *argv[])
{
	_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF  );
	
	for ( int x = 0; x<100; x++ ) {
		HMODULE hDll = ::LoadLibrary(L"test_dll.dll");
		
		PC pc = (PC) ::GetProcAddress(hDll,"gtkmm_test" );
		pc(argc, argv);

		::FreeLibrary( hDll );
	}
    return 0;
}

The "gtkmm_test" is a static function exported from the test_dll.dll and is defined as follows :

extern "C" __declspec(dllexport) void gtkmm_test( int argc, char *argv [] )
{
	    Gtk::Main kit(argc, argv);
}

If you execute the above, the amount of memory that is reported by the crt debug function increases as well as the total memory usage. Sadly, for us at least, the reported memory leaks are valid.

I have uploaded the sources for my test program ( VS2005 required ) for verification under :
http://rainestorm.org/craine/gtkmm_memleak.zip

regards,
Christopher Raine






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]