VirtualBox

Changeset 12457 in vbox for trunk


Ignore:
Timestamp:
Sep 15, 2008 11:14:35 AM (16 years ago)
Author:
vboxsync
Message:

Fixed small memory leak in the Windows implementation.
Fixed lack of destructor call for the host specific Collector classes. (virtual destructor; caused
crash at exit in VBoxSVC.exe)

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/Performance.h

    r12400 r12457  
    137137    {
    138138    public:
     139        virtual ~CollectorHAL() { };
    139140        virtual int preCollect(const CollectorHints& hints) { return VINF_SUCCESS; }
    140141        virtual int getHostCpuLoad(ULONG *user, ULONG *kernel, ULONG *idle);
  • trunk/src/VBox/Main/solaris/PerformanceSolaris.cpp

    r12400 r12457  
    4444public:
    4545    CollectorSolaris();
    46     ~CollectorSolaris();
     46    virtual ~CollectorSolaris();
    4747    virtual int getHostMemoryUsage(ULONG *total, ULONG *used, ULONG *available);
    4848    virtual int getProcessMemoryUsage(RTPROCESS process, ULONG *used);
  • trunk/src/VBox/Main/win/PerformanceWin.cpp

    r12418 r12457  
    4040public:
    4141    CollectorWin();
    42     ~CollectorWin();
     42    virtual ~CollectorWin();
    4343
    4444    virtual int preCollect(const CollectorHints& hints);
     
    185185    mHostCpuLoadIdleHandle   = getPropertyHandle(apEnumAccess[0], L"PercentProcessorTime");
    186186
     187    for (unsigned i=0;i<dwNumReturned;i++)
     188        apEnumAccess[i]->Release();
     189
    187190    delete [] apEnumAccess;
    188191
     
    196199    mProcessMemoryUsedHandle       = getPropertyHandle(apEnumAccess[0], L"WorkingSet");
    197200
     201    for (unsigned i=0;i<dwNumReturned;i++)
     202        apEnumAccess[i]->Release();
     203
    198204    delete [] apEnumAccess;
    199205}
     
    201207CollectorWin::~CollectorWin()
    202208{
     209    IWbemConfigureRefresher *pConfig = NULL;
     210    HRESULT                 hr = S_OK;
     211
    203212    if (NULL != mNameSpace)
    204213    {
    205214        mNameSpace->Release();
     215    }
     216    if (NULL != mRefresher)
     217    {
     218        if (SUCCEEDED (hr = mRefresher->QueryInterface(
     219            IID_IWbemConfigureRefresher,
     220            (void **)&pConfig)))
     221        {
     222            // Remove the enumerators from the refresher.
     223            hr = pConfig->Remove(mEnumProcessorID, 0);
     224            Assert(SUCCEEDED(hr));
     225            hr = pConfig->Remove(mEnumProcessID, 0);
     226            Assert(SUCCEEDED(hr));
     227
     228            pConfig->Release();
     229        }
    206230    }
    207231    if (NULL != mEnumProcessor)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette