Yes, it looks like it should clean up after itself but apparently isn't. I'd
try putting a debug message in the destructor and verify it at least is getting
called. I haven't looked at that code myself unfortunately.
> Hi,
> The motivation for my question is because I am seeing a small leak in my
> module.
> My module periodically fetches data using the Async api. When I disable the
> periodic
> fetching I don't see a leak (I ensured there is none of my other code is
> running).
> I reduced my code base to fetch and forget. I still see the leak. The API
> documentation
> states that the memory would be freed and it doesn't seem to be happening.
> Any help is appreciated. Thanks.
> Dk.
> /**
> * @brief This class provides an implementation of AsyncProvider that
> * makes HTTP requests asynchronously. This provider automatically
> * self-destructs after the completion of the request.
> *
> * See example async_http_fetch{,_streaming} for sample usage.
> */
> class AsyncHttpFetch : public AsyncProvider
> {
> ...
> }
> On Wed, Mar 22, 2017 at 1:37 PM, Dk Jack <[email protected]> wrote:
>> Hi,
>> In the file lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc,
>> there is this code:
>>
>> ------------------------------------------------------------
>> -------------------------------------------
>> // we'll add some custom headers for this request
>> AsyncHttpFetch2 *provider2 = new AsyncHttpFetch2("http://127.0.0.1/");
>> Headers &request_headers = provider2->getRequestHeaders();
>> request_headers.set("Header1", "Value1");
>> request_headers.set("Header2", "Value2");
>> Async::execute<AsyncHttpFetch2>(this, provider2, getMutex());
>> ------------------------------------------------------------
>> ---------------------------------------------
>>
>> what is the lifetime of 'provider2'? I am assuming plugin owner is
>> responsible for
>> freeing this object. If so, when can I destroy this object?
>>
>> Is the handle return in handleAnyAsyncComplete the same as 'provider2'?
>> thanks.
>>
>> Dk.
>>
>>
>>