Heap and async / threaded web service calls in C++ RRS feed

  • Question

  • I am writing an application that needs to make background calls using wwsapi and service proxy generated by wsutil (Visual Studio 2015 / C++).  The standard synchronous, blocking calls I have been writing allocate memory to a WS_HEAP variable using WsCreateHeap() and free memory after the call using WsFreeHeap() and these calls work fine.

    I have found some examples for async web service calls that show how to pass WS_ASYNC_CONTEXT like this one But I do not understand how/when the heap needs to be managed in this case - if I free the heap in the call back or after the callback, I get an exception for unauthorized access.  If I make a regular synchronous call I don't get an exception (I am making the service proxy web service calls from inside a thread.)

    I don't actually have a use for the CALLBACK functionality at the moment, I just want to be sure I'm not leaking memory, and need to be able to make web service calls without blocking the UI.

    Wednesday, June 22, 2016 9:23 PM