Click here to Skip to main content
15,886,810 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C++
i got following example
// MyWnd.h
class CMyWnd : public CWnd
{
        DECLARE_DYNAMIC(CMyWnd)
public:
        CMyWnd();
        virtual ~CMyWnd();

        void Create();
        void CreateChildren();
        BOOL DestroyChildren();
protected:
        DECLARE_MESSAGE_MAP()
private:
        CMyActiveX m_oMyActiveX;
};

//MyWnd.cpp
IMPLEMENT_DYNAMIC(CMyWnd, CWnd)
CMyWnd::CMyWnd()
{
}
CMyWnd::~CMyWnd()
{
        DestroyWindow();
}
BEGIN_MESSAGE_MAP(CMyWnd, CWnd)
END_MESSAGE_MAP()
void CMyWnd::Create()
{
        // Create our window, which will catch page events
        CreateEx( 0, AfxRegisterWndClass( WS_OVERLAPPED ), _T(""), WS_OVERLAPPED, 0, 0, 0, 0, NULL, (HMENU) 0 );
}
void CMyWnd::CreateChildren()
{
        const int CTRL_ID = 1000;
        // Create a form control
       m_oMyActiveX.Create( NULL, WS_CHILD, CRect( 0, 0, 0, 0 ), this, CTRL_ID, NULL, FALSE, CComBSTR(L"AAAAAAAAAAA") );
}
BOOL CMyWnd::DestroyChildren()
{
        m_oMyActiveX.DestroyWindow();

        return TRUE;
}
// TEST 1
const int TEST_COUNT = 50000;
CMyWnd oMy;
oMy.Create();
for (int i = 0; i < TEST_COUNT; i++) {
        oMy.CreateChildren();
        oMy.DestroyChildren();
}
// TEST 2
const int TEST_COUNT = 50000;
for (int i = 0; i < TEST_COUNT; i++) {
        CMyWnd oMy;
        oMy.Create();
        oMy.CreateChildren();
}
// TEST 3
const int TEST_COUNT = 50000;
for (int i = 0; i < TEST_COUNT; i++) {
        CMyWnd oMy;
        oMy.Create();
        oMy.CreateChildren();
oMy.DestroyChildren();
}

I use Performance Monitor tool to monitor private bytes index.
TEST 1: The private bytes is straight line
<img src="http://i60.tinypic.com/28bz0hx.jpg" border="0" alt="Image and video hosting by TinyPic">
TEST 2: The private bytes is gradient line
<img src="http://i62.tinypic.com/2dltabt.jpg" border="0" alt="Image and video hosting by TinyPic">
TEST 3: The private bytes is gradient line
<img src="http://i57.tinypic.com/347cj6w.jpg" border="0" alt="Image and video hosting by TinyPic">
Can you explain why i got difference results ?
Posted
Updated 28-Jan-15 16:20pm
v3
Comments
Sergey Alexandrovich Kryukov 28-Jan-15 21:28pm    
Not clear. Your links don't show anything relevant. Why asking us about the code you did not write yourself? Why not asking the author of this code? Write some code yourself and ask about your problems. Anyway, problem description is not clear, and nothing relevant cannot be found in your code sample. Please, try to ask a proper question. Use "Improve question" above.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900