You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be a memory leak when running applications that repeatedly create threads (letting them finish each time). As shown by the perfmon graph below, the memory usage continues to increase overtime whereas it stays the same when running natively.
To Reproduce
The program is a simple multi-threaded program pasted here:
#include <windows.h>
#include <iostream>
#include <chrono>
#include <thread>
using namespace std;
DWORD WINAPI thread1(LPVOID lpParameter)
{
unsigned int& size = *((unsigned int*)lpParameter);
for (int i = 0; i < 20000000 * (rand()%100); i++)
{
if ((i%100000000 == 0))
{
cout << "thread 1 " << i << endl;
}
}
return 0;
}
DWORD WINAPI thread2(LPVOID lpParameter)
{
unsigned int& size = *((unsigned int*)lpParameter);
for (int i = 0; i < 2000000000; i++)
{
if ((i % 10000000 == 0))
{
cout << "thread 2 " << i << endl;
}
}
return 0;
}
#define NUM 800
int main(int argc, char* argv[])
{
//BOOL debugging = TRUE;
//while (debugging) {
// BOOL debuggerPresent = FALSE;
// if (CheckRemoteDebuggerPresent(GetCurrentProcess(), &debuggerPresent) && debuggerPresent) {
// DebugBreak();
// debugging = FALSE;
// }
// Sleep(1000);
//}
unsigned int s1 = 10;
unsigned int s2 = 20;
DWORD myThreadID[NUM];
HANDLE myHandle[NUM];
while (1)
{
for (int i = 0; i < NUM; i++)
{
myHandle[i] = CreateThread(0, 0, thread1, &s1, 0, myThreadID + i);
}
//cout << myThreadID << " " << myThreadID2 << endl;
for (int i = 0; i < NUM; i++)
{
WaitForSingleObject(myHandle[i], INFINITE);
}
for (int i = 0; i < NUM; i++)
{
cout << CloseHandle(myHandle[i]) << endl;
}
std::this_thread::sleep_for(std::chrono::milliseconds(8000));
}
return 0;
}
Versions
What version of DynamoRIO are you using? 8.0.18446
What operating system version are you running on? ("Windows 10" is not sufficient: give the release number.) Windows 10 OS build 19041.329
Is your application 32-bit or 64-bit? 32-bit application
Additional context
There was a recently filed commit link here that seemed to address something similar to the issue I am facing here. Though I am not sure it is the same issue and whether i#4334 was tested on Windows. Perhaps the same issue seen in that bug has not yet been address on Windows?
Perfmon graph:
The text was updated successfully, but these errors were encountered:
#4334 bailed on Windows due to the test hitting re-attach problems, and manually Windows was not examined, so there may well be some Windows-specific accumulations beyond the fixes in PR #4350 (most of which were cross-OS).
Note that these "leaks" would not be caught by reachability-based leak checkers as they are still reachable (and freed later): they would be called "accumulations" rather than "leaks" most likely, though the impact during the run is the same.
Describe the bug
There seems to be a memory leak when running applications that repeatedly create threads (letting them finish each time). As shown by the perfmon graph below, the memory usage continues to increase overtime whereas it stays the same when running natively.
To Reproduce
The program is a simple multi-threaded program pasted here:
Versions
https://github.com/DynamoRIO/dynamorio/wiki/Latest-Build solve the problem? No
Additional context
There was a recently filed commit link here that seemed to address something similar to the issue I am facing here. Though I am not sure it is the same issue and whether i#4334 was tested on Windows. Perhaps the same issue seen in that bug has not yet been address on Windows?
Perfmon graph:
The text was updated successfully, but these errors were encountered: