VirtualBox

Ignore:
Timestamp:
May 30, 2013 12:41:48 PM (12 years ago)
Author:
vboxsync
Message:

Main/Host: switch to Runtime functions for determining the amount of total / available RAM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/HostImpl.cpp

    r46326 r46330  
    10421042    // no locking required
    10431043
    1044     /* @todo This is an ugly hack. There must be a function in IPRT for that. */
    1045     pm::CollectorHAL *hal = pm::createHAL();
    1046     if (!hal)
     1044    uint64_t cb;
     1045    int rc = RTSystemQueryTotalRam(&cb);
     1046    if (RT_FAILURE(rc))
    10471047        return E_FAIL;
    1048     ULONG tmp;
    1049     int rc = hal->getHostMemoryUsage(aSize, &tmp, &tmp);
    1050     *aSize /= 1024;
    1051     delete hal;
    1052     return rc;
     1048    *aSize = cb / _1M;
     1049    return S_OK;
    10531050}
    10541051
     
    10641061    // no locking required
    10651062
    1066     /* @todo This is an ugly hack. There must be a function in IPRT for that. */
    1067     pm::CollectorHAL *hal = pm::createHAL();
    1068     if (!hal)
     1063    uint64_t cb;
     1064    int rc = RTSystemQueryAvailableRam(&cb);
     1065    if (RT_FAILURE(rc))
    10691066        return E_FAIL;
    1070     ULONG tmp;
    1071     int rc = hal->getHostMemoryUsage(&tmp, &tmp, aAvailable);
    1072     *aAvailable /= 1024;
    1073     delete hal;
    1074     return rc;
     1067    *aAvailable = cb / _1M;
     1068    return S_OK;
    10751069}
    10761070
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