UDT4.3 try to save variable[UDT::lasterror] by TLS functions(TlsAlloc,TlsGetValue...) but after my test, I find it will dump to memory's leak.
First, I have changed UDT's code, add UDT::initialize(),UDT::release to manage CUDT::s_UDTUnited
void main() { UDT::initialize(); UDT::getlasterror(); UDT::release(); ::_CrtDumpMemoryLeaks(); }
because the three function is in mainthread,so memory is not leaked. but we can change to multi-thread mode( for simple,I wrote by boost)
void thread1() { UDT::getlasterror(); } void main() { UDT::initialize(); boost::thread thd(&thread1); thd.join(); UDT::release(); ::_CrtDumpMemoryLeaks(); } memory leaks will happen
Detected memory leaks! Dumping objects -> {187} normal block at 0x0014AD78, 160 bytes long. Data: < c:\udt4.3\sr> 00 00 00 00 63 3A 5C 75 64 74 34 2E 33 5C 73 72 Object dump complete. udt Leaked object at 0014ADE8 (size 48, c:\udt4.3\src\api.cpp:1152)
I suggest to remove TLS from UDT
Thanks, I think I can fix this problem without removing TLS. I need that for thread-specific getLassError().
Log in to post a comment.
UDT4.3 try to save variable[UDT::lasterror] by TLS functions(TlsAlloc,TlsGetValue...)
but after my test, I find it will dump to memory's leak.
First, I have changed UDT's code, add UDT::initialize(),UDT::release to manage CUDT::s_UDTUnited
void main()
{
UDT::initialize();
UDT::getlasterror();
UDT::release();
::_CrtDumpMemoryLeaks();
}
because the three function is in mainthread,so memory is not leaked.
but we can change to multi-thread mode( for simple,I wrote by boost)
void thread1()
{
UDT::getlasterror();
}
void main()
{
UDT::initialize();
boost::thread thd(&thread1);
thd.join();
UDT::release();
::_CrtDumpMemoryLeaks();
}
memory leaks will happen
Detected memory leaks!
Dumping objects ->
{187} normal block at 0x0014AD78, 160 bytes long.
Data: < c:\udt4.3\sr> 00 00 00 00 63 3A 5C 75 64 74 34 2E 33 5C 73 72
Object dump complete.
udt Leaked object at 0014ADE8 (size 48, c:\udt4.3\src\api.cpp:1152)
I suggest to remove TLS from UDT
Thanks, I think I can fix this problem without removing TLS. I need that for thread-specific getLassError().