Share via

Memory Leak in Winhttp 6.1 routine WinHttpSendRequest() on Windows 7

Anonymous
2016-04-13T18:04:48+00:00

I posted the following issue in microsoft.public.winhttp of https://groups.google.com/forum/#!forum/microsoft.public.winhttp with topic "Memory Leak in WinHttpSendRequest()".

I believe this WinHttpSendRequest() function is still producing memory leak in Windows 7 (WinHttp 6.1), here what I have: 

Platform: Windows 7 Enterprise (version 6.1 SP1) 64 bit platform. 

WinHttp: version 6.1.7601.17514. 

Visual Studio version: Microsoft Visual Studio Ultimate 2013, Version 12.0.31101.00 Update 4. 

Memory leak detect tool: perfmon, using "private bytes". 

Symptom: With calling WinHttpSendRequest() memory keep increasing even though it looks like a square, but the trend is going upward. Without calling WinHttpSendRequest, the trend is pretty much flat line even though it looks like a square. 

The following is the code, 

==============================

Windows for home | Previous Windows versions | Performance and system failures

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2016-04-14T12:15:56+00:00

Hi,

Thank you for posting your query on Microsoft Community.

I would suggest you to re-post your query on MSDN Forums as we have experts working on such type of issues and to help you in a better way.

Refer to the link:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=visualstudio

Hope this information helps. Please let us know if you need any other assistance with Windows in future. We will be happy to assist you.

Was this answer helpful?

0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2016-04-13T18:10:37+00:00

    It seems the editor has a max, I'm including the link to google for the complete source code:

    https://groups.google.com/forum/#!topic/microsoft.public.winhttp/KMaHFiujLA4

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2016-04-13T18:06:28+00:00

    #include "stdafx.h" 

    #include <stdlib.h> 

    #include <crtdbg.h> 

    #include <errno.h> 

    #include <windows.h> 

    #include <winhttp.h> 

    #include <iostream> 

    #include <sstream> 

    #include <fstream> 

    #include <string> 

    #include<cstring> 

    #include <fstream> 

    #include <sddl.h> 

    #include <vector> 

    #include <Wincrypt.h> 

    #pragma comment(lib, "winhttp.lib") 

    UINT32 

    winhttpGet(HINTERNET Initialize) 

      UINT32 sts = 0; 

      HINTERNET Connection, File; 

      Connection = WinHttpConnect(Initialize, 

        L"www.microsoft.com", //L"www.google.com", 

        443, 

        0); 

      if (!Connection) 

      { 

        LPVOID nt_msg; 

        int err_id = GetLastError(); 

        FormatMessage(FORMAT_MESSAGE_

    Was this answer helpful?

    0 comments No comments