简体   繁体   中英

Intel c++ CreateWindow kernel resource leak

I am using Parallel Studio (from Intel) and the Intel c++ Compiler.

The Memory Problem analyzer always tells me, that I have a Kernel resource leak in my CreateWindow function.

The Function Call is located at line 26 in my Header File.

No matter what I do, the leak always appears (calling DestroyWindow in the Destructor of the class etc.)

Header: http://beta.pastie.org/private/ze8x59f1nfkjz0wcrromew

Source: http://beta.pastie.org/5425046

The class in the code you linked doesn't have a destructor.

Anyway, it might be something that CreateWindow does that looks like a memory leak but isn't.

PS don't register the WNDCLASS on each instantiation of a CWindow. Register it once at program startup. You can create a private WindowClass singleton class inside CWindow that handles window class registration:

class CWindow
{
private:
    class CWindowClass
    {
    private:
        static CWindowClass m_windowClass;

        CWindowClass()
        {
            // Register a WNDCLASS
        }

        ~CWindowClass() {}
    }

    ...
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM