Hi,
I am using casablanca from NUGet (<package id="cpprestsdk" version="2.4.0.1" targetFramework="Native" />). VS2013. I have a cpu and memory leak on practical empty project (few hours testing) and one project only returning some demo JSON values (over weekend). Both test had get requests 10 times per second. Demo data was a list of 20 items with 3 strings. I tested it with perfmon so I do not have any leak report. Perfmon screenshot in attachment. Can anybody help? This is simplified version:
```
void request_handler(http_request req)
{
http_response response(web::http::status_codes::OK);
req.reply(response);
}
int main()
{
http_listener listener(U("http://localhost:9888/services/"));
listener.open().wait();
listener.support(&request_handler);
while (true) {
this_thread::sleep_for(chrono::milliseconds(2000));
}
...
}
```
Comments: Hi krajna, I think this is an already solved known issue. Basically the problem is with the task scheduling in the PPL library that we use. With Visual Studio 2013 it schedules work on the Concurrency Runtime and over time this can run into issues with too many threads being creating both eating up memory and the CPU. The fix is to have work scheduled on the Windows Threadpool which handles better the management of threads. For more details on the problem take a look at this previous [issue](https://casablanca.codeplex.com/workitem/341). It has 2 ways to fix, one is upgrading to Visual Studio 2015, the other is to recompile the C++ REST SDK with the macro CPPREST_FORCE_PPLX. Steve
I am using casablanca from NUGet (<package id="cpprestsdk" version="2.4.0.1" targetFramework="Native" />). VS2013. I have a cpu and memory leak on practical empty project (few hours testing) and one project only returning some demo JSON values (over weekend). Both test had get requests 10 times per second. Demo data was a list of 20 items with 3 strings. I tested it with perfmon so I do not have any leak report. Perfmon screenshot in attachment. Can anybody help? This is simplified version:
```
void request_handler(http_request req)
{
http_response response(web::http::status_codes::OK);
req.reply(response);
}
int main()
{
http_listener listener(U("http://localhost:9888/services/"));
listener.open().wait();
listener.support(&request_handler);
while (true) {
this_thread::sleep_for(chrono::milliseconds(2000));
}
...
}
```
Comments: Hi krajna, I think this is an already solved known issue. Basically the problem is with the task scheduling in the PPL library that we use. With Visual Studio 2013 it schedules work on the Concurrency Runtime and over time this can run into issues with too many threads being creating both eating up memory and the CPU. The fix is to have work scheduled on the Windows Threadpool which handles better the management of threads. For more details on the problem take a look at this previous [issue](https://casablanca.codeplex.com/workitem/341). It has 2 ways to fix, one is upgrading to Visual Studio 2015, the other is to recompile the C++ REST SDK with the macro CPPREST_FORCE_PPLX. Steve