The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Consider the creation of a linked cancellation source between Cancellation sources A and B. B is a long-lived cancellation token. When A is canceled, the cancellation registration for the callback on B is never unregistered, so it lives on in memory. This can be a significant source of runtime leaks, in a pattern similar to those caused by pplx task cancellation semantics.
Note that this is not technically a memory leak, since everything is still referenced, though it is hugely problematic. Certain architectures can rely on long-lived cancellation tokens from which many linked tokens are created. These long-lived tokens can accumulate an unbounded number of functionally useless cancellation registrations over time, wasting system resources.
This problem can be solved by adding a clause to the cancellation callback on line 1009 that unregisters other remaining callbacks.
https://github.com/Microsoft/cpprestsdk/blob/a7e49f51866b3c743024ec919977356b06eb9bdd/Release/include/pplx/pplxcancellation_token.h#L1003-L1012
Consider the creation of a linked cancellation source between Cancellation sources A and B. B is a long-lived cancellation token. When A is canceled, the cancellation registration for the callback on B is never unregistered, so it lives on in memory. This can be a significant source of runtime leaks, in a pattern similar to those caused by pplx task cancellation semantics.
Note that this is not technically a memory leak, since everything is still referenced, though it is hugely problematic. Certain architectures can rely on long-lived cancellation tokens from which many linked tokens are created. These long-lived tokens can accumulate an unbounded number of functionally useless cancellation registrations over time, wasting system resources.
This problem can be solved by adding a clause to the cancellation callback on line 1009 that unregisters other remaining callbacks.