EDN Admin
Well-known member
This small simple piece of code appears to show there is a memory leak in the WASLookupServiceBegin when used for searching for a Bluetooth Device. If you run the code and monitor the "Mem Usage" in Task Manager the value increases. Similarly if you monitors "Private Bytes" for the process the pegged value increases.<br/><br/>This code was compiled using VS 2008. Has anyone else come across this or could someone possibly advise where my code sample is incorrect.<br/><span style="font-size:x-small <br/>WSAQUERYSET querySet;
<span style="font-size:x-small memset(&querySet, 0, sizeof(querySet));<br/>querySet.dwSize = sizeof(querySet);<br/>querySet.dwNameSpace = NS_BTH;
<span style="font-size:x-small HANDLE hLookup;<br/>DWORD flags = LUP_CONTAINERS;
<span style="font-size:x-small for (int loop =0; loop < 32766; loop++)<br/>{<br/> int result = WSALookupServiceBegin(&querySet, flags, &hLookup);
<span style="font-size:x-small if (0 == result)<br/> {<br/> printf("WSALookupServiceBegin() - ok. Loop: %dn", loop); <br/> result = WSALookupServiceEnd(hLookup);<br/> }<br/> else<br/> {<br/> printf("WSALookupServiceBegin() - Error: %s. Loop: %dn", GetLastErrorMessage(GetLastError()), loop);<br/> }<br/>}
View the full article
<span style="font-size:x-small memset(&querySet, 0, sizeof(querySet));<br/>querySet.dwSize = sizeof(querySet);<br/>querySet.dwNameSpace = NS_BTH;
<span style="font-size:x-small HANDLE hLookup;<br/>DWORD flags = LUP_CONTAINERS;
<span style="font-size:x-small for (int loop =0; loop < 32766; loop++)<br/>{<br/> int result = WSALookupServiceBegin(&querySet, flags, &hLookup);
<span style="font-size:x-small if (0 == result)<br/> {<br/> printf("WSALookupServiceBegin() - ok. Loop: %dn", loop); <br/> result = WSALookupServiceEnd(hLookup);<br/> }<br/> else<br/> {<br/> printf("WSALookupServiceBegin() - Error: %s. Loop: %dn", GetLastErrorMessage(GetLastError()), loop);<br/> }<br/>}
View the full article