VirtualBox

Changeset 103563 in vbox


Ignore:
Timestamp:
Feb 26, 2024 11:31:39 AM (9 months ago)
Author:
vboxsync
Message:

libs/xpcom: Replace some nsMemory:: calls to RTMemAlloc/RTMemFree to get more accurate memory tracking with the IPRT memory tracker, buref:10598

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp

    r103562 r103563  
    503503    case nsXPTType::T_IID:
    504504      {
    505         nsID *buf = (nsID *) nsMemory::Alloc(sizeof(nsID));
     505        nsID *buf = (nsID *)RTMemAlloc(sizeof(nsID));
    506506        IPCMsgReaderReadBytes(pMsgReader, buf, sizeof(nsID));
    507507        v.val.p = buf;
     
    520520        else
    521521        {
    522           char *buf = (char *) nsMemory::Alloc(len + 1);
     522          char *buf = (char *)RTMemAlloc(len + 1);
    523523          IPCMsgReaderReadBytes(pMsgReader, buf, len);
    524524          buf[len] = char(0);
     
    540540        else
    541541        {
    542           PRUnichar *buf = (PRUnichar *) nsMemory::Alloc(len + 2);
     542          PRUnichar *buf = (PRUnichar *)RTMemAlloc(len + 2);
    543543          IPCMsgReaderReadBytes(pMsgReader, buf, len);
    544544          buf[len / 2] = PRUnichar(0);
     
    686686
    687687  if (v.IsValAllocated())
    688     nsMemory::Free(v.val.p);
     688    RTMemFree(v.val.p);
    689689  else if (v.IsValInterface())
    690690    ((nsISupports *) v.val.p)->Release();
     
    745745    case nsXPTType::T_IID:
    746746      {
    747         nsID *buf = (nsID *) nsMemory::Alloc(sizeof(nsID));
     747        nsID *buf = (nsID *)RTMemAlloc(sizeof(nsID));
    748748        IPCMsgReaderReadBytes(pMsgReader, buf, sizeof(nsID));
    749749        *((nsID **) v.val.p) = buf;
     
    765765        else
    766766        {
    767           char *buf = (char *) nsMemory::Alloc(len + 1);
     767          char *buf = (char *)RTMemAlloc(len + 1);
    768768          IPCMsgReaderReadBytes(pMsgReader, buf, len);
    769769          buf[len] = char(0);
     
    788788        else
    789789        {
    790           PRUnichar *buf = (PRUnichar *) nsMemory::Alloc(len + 2);
     790          PRUnichar *buf = (PRUnichar *)RTMemAlloc(len + 2);
    791791          IPCMsgReaderReadBytes(pMsgReader, buf, len);
    792792          buf[len / 2] = PRUnichar(0);
     
    803803        // deserialize the DConAddr and the original value of v.val.p
    804804        // into v.val.p temporarily.  needs temporary memory alloc.
    805         DConAddrPlusPtr *buf = (DConAddrPlusPtr *) nsMemory::Alloc(sizeof(DConAddrPlusPtr));
     805        DConAddrPlusPtr *buf = (DConAddrPlusPtr *)RTMemAlloc(sizeof(DConAddrPlusPtr));
    806806        IPCMsgReaderReadBytes(pMsgReader, &buf->addr, sizeof(DConAddr));
    807807        buf->p = v.val.p;
     
    11071107  // malloc(0) returns a null pointer or not (which is used in isNull())
    11081108  // is implementation-dependent according to the C standard
    1109   void *arr = nsMemory::Alloc((size ? size : 1) * elemSize);
     1109  void *arr = RTMemAlloc((size ? size : 1) * elemSize);
    11101110  if (arr == nsnull)
    11111111    return NS_ERROR_OUT_OF_MEMORY;
     
    11611161
    11621162  if (NS_FAILED(rv))
    1163     nsMemory::Free(arr);
     1163    RTMemFree(arr);
    11641164  else
    11651165    array = arr;
     
    24082408          iid->Equals(NS_GET_IID(nsISupports)))
    24092409      {
    2410         nsMemory::Free((void*)iid);
     2410        RTMemFree((void*)iid);
    24112411
    24122412        // nsISupports is queried on nsISupports, return ourselves
     
    24202420      }
    24212421      if (iid)
    2422         nsMemory::Free((void*)iid);
     2422        RTMemFree((void*)iid);
    24232423    }
    24242424
     
    26782678          PtrBits bits = dptr->addr;
    26792679          aParams[i].val.p = dptr->p;
    2680           nsMemory::Free((void *)dptr);
     2680          RTMemFree((void *)dptr);
    26812681
    26822682          // DeserializeInterfaceParamBits needs IID only if it's a remote object
     
    36973697  Log(("  request-index=%d\n", (PRUint32) invoke->request_index));
    36983698
    3699   params = new nsXPTCVariant[paramCount];
     3699  params = (nsXPTCVariant *)RTMemAllocZ(sizeof(nsXPTCVariant) * paramCount);
    37003700  if (!params)
    37013701  {
     
    39153915    for (i=0; i<paramUsed; ++i)
    39163916      FinishParam(params[i]);
    3917     delete[] params;
    3918   }
    3919 }
     3917    RTMemFree(params);
     3918  }
     3919}
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