How to clear the data downloaded with Curl from the process memory? [duplicate]

  c++, libcurl, windows

Im downloading/reading data from my database with Curl and the following code:

    static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) 
    {
        ((std::string*)userp)->append((char*)contents, size * nmemb);
        return size * nmemb;
    }


   void Url(std::string url, std::string mode, std::string json) 
   {
 
        CURLcode ret;
        CURL *curl;
        struct curl_slist *slist1;  

        curl = curl_easy_init();
        curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
        curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);

        if (!json.empty()) {

            slist1 = NULL;
            slist1 = curl_slist_append(slist1, "Content-Type: application/json");
            curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json.c_str());
            //curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/7.38.0");
            curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist1);

        }

        curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L);
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, mode.c_str());
        curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
        
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &data);
        
        ret = curl_easy_perform(curl);
        
        curl_easy_cleanup(curl);
        curl = NULL;

        if (!json.empty()) {
            curl_slist_free_all(slist1);
            slist1 = NULL;
        }
       
        //...
    }

When i go to the process which calls the code above and creates a dump file from it, I can find all the data received from the Curl call.

Is possible somehow to clear or disable it from being stored?

Source: Windows Questions

LEAVE A COMMENT